final class CouchDbUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
LINE_SEP |
| Modifier | Constructor and Description |
|---|---|
private |
CouchDbUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertNotEmpty(java.lang.Object object,
java.lang.String prefix) |
static void |
assertNull(java.lang.Object object,
java.lang.String prefix) |
static void |
close(java.io.Closeable c)
Closes a resource.
|
static void |
close(org.apache.http.HttpResponse response)
Closes the response input stream.
|
static java.lang.String |
generateUUID() |
static int |
getAsInt(com.google.gson.JsonObject j,
java.lang.String e) |
static long |
getAsLong(com.google.gson.JsonObject j,
java.lang.String e) |
static java.lang.String |
getAsString(com.google.gson.JsonObject j,
java.lang.String e) |
static java.io.InputStream |
getStream(org.apache.http.HttpResponse response) |
static <T> T |
JsonToObject(com.google.gson.Gson gson,
com.google.gson.JsonElement elem,
java.lang.String key,
java.lang.Class<T> classType) |
static java.util.List<java.lang.String> |
listResources(java.lang.String path)
List directory contents for a resource folder.
|
static java.lang.String |
readFile(java.lang.String path) |
static java.lang.String |
removeExtension(java.lang.String fileName) |
static java.lang.String |
streamToString(java.io.InputStream in) |
public static void assertNotEmpty(java.lang.Object object,
java.lang.String prefix)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static void assertNull(java.lang.Object object,
java.lang.String prefix)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static java.lang.String generateUUID()
public static <T> T JsonToObject(com.google.gson.Gson gson,
com.google.gson.JsonElement elem,
java.lang.String key,
java.lang.Class<T> classType)
public static java.lang.String getAsString(com.google.gson.JsonObject j,
java.lang.String e)
public static long getAsLong(com.google.gson.JsonObject j,
java.lang.String e)
long, or 0 if not found.public static int getAsInt(com.google.gson.JsonObject j,
java.lang.String e)
int, or 0 if not found.public static java.util.List<java.lang.String> listResources(java.lang.String path)
clazz - Any java class that lives in the same place as the resources you want.path - Should end with "/", but not start with one.public static java.lang.String readFile(java.lang.String path)
public static java.io.InputStream getStream(org.apache.http.HttpResponse response)
InputStream of HttpResponsepublic static java.lang.String removeExtension(java.lang.String fileName)
public static java.lang.String streamToString(java.io.InputStream in)
public static void close(org.apache.http.HttpResponse response)
response - The HttpResponsepublic static void close(java.io.Closeable c)
c - The Closeable resource.