Package org.lightcouch
Class CouchDbUtil
java.lang.Object
org.lightcouch.CouchDbUtil
Provides various utility methods, for internal use.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertNotEmpty
(Object object, String prefix) static void
assertNull
(Object object, String prefix) static void
Closes a resource.static void
close
(org.apache.http.HttpResponse response) Closes the response input stream.static String
static int
static long
static String
getAsString
(com.google.gson.JsonObject j, String e) static InputStream
getStream
(org.apache.http.HttpResponse response) static <T> T
JsonToObject
(com.google.gson.Gson gson, com.google.gson.JsonElement elem, String key, Class<T> classType) listResources
(String path) List directory contents for a resource folder.static String
static String
removeExtension
(String fileName) static String
-
Field Details
-
LINE_SEP
-
SPRING_BOOT_DIR
- See Also:
-
-
Constructor Details
-
CouchDbUtil
private CouchDbUtil()
-
-
Method Details
-
assertNotEmpty
- Throws:
IllegalArgumentException
-
assertNull
- Throws:
IllegalArgumentException
-
generateUUID
-
JsonToObject
-
getAsString
- Returns:
- A JSON element as a String, or null if not found.
-
getAsLong
- Returns:
- A JSON element as
long
, or0
if not found.
-
getAsInt
- Returns:
- A JSON element as
int
, or0
if not found.
-
listResources
List directory contents for a resource folder. Not recursive. This is basically a brute-force implementation. Works for regular files and also JARs.- Parameters:
path
- Should end with "/", but not start with one.- Returns:
- Just the name of each member item, not the full paths.
-
readFile
-
getStream
- Returns:
InputStream
ofHttpResponse
-
removeExtension
-
streamToString
-
close
public static void close(org.apache.http.HttpResponse response) Closes the response input stream.- Parameters:
response
- TheHttpResponse
-
close
Closes a resource.- Parameters:
c
- TheCloseable
resource.
-