|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javalite.common.Util
public class Util
| Constructor Summary | |
|---|---|
Util()
|
|
| Method Summary | |
|---|---|
static boolean |
blank(Object value)
Returns true if value is either null or it's String representation is empty. |
static byte[] |
bytes(InputStream in)
Reads contents of the input stream fully and returns it as byte array. |
static void |
close(Closeable c)
|
static List<String> |
getResourceLines(String resourceName)
Returns lines of text of a resource as list. |
static String |
getStackTraceString(Throwable throwable)
Converts stack trace to string. |
static String |
join(Collection collection,
String delimiter)
Joins the items in collection with a delimiter. |
static String |
join(String[] collection,
String delimiter)
Joins the items in collection with a delimiter. |
static byte[] |
read(File file)
Reads file into a byte array. |
static String |
read(InputStream in)
Reads contents of the input stream fully and returns it as String. |
static String |
read(InputStream in,
String charset)
Reads contents of the input stream fully and returns it as String. |
static String |
readFile(String fileName)
Reads contents of file fully and returns as string. |
static String |
readFile(String fileName,
String charset)
Reads contents of file fully and returns as string. |
static String |
readResource(String resourceName)
Reads contents of resource fully into a string. |
static String |
readResource(String resourceName,
String charset)
Reads contents of resource fully into a string. |
static byte[] |
readResourceBytes(String resourceName)
Reads contents of resource fully into a byte array. |
static void |
saveTo(String path,
InputStream in)
Saves content read from input stream into a file. |
static String[] |
split(String input,
char delimiter)
Splits a string into an array using a provided delimiter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Util()
| Method Detail |
|---|
public static byte[] readResourceBytes(String resourceName)
resourceName - resource name.
public static String readResource(String resourceName)
resourceName - resource name.
public static String readResource(String resourceName,
String charset)
resourceName - resource name.charset - name of supported charset
public static String readFile(String fileName)
fileName - file name.
public static String readFile(String fileName,
String charset)
fileName - file name.
public static void close(Closeable c)
public static String read(InputStream in)
throws IOException
in - InputStream to read from.
IOException - in case of IO error
public static String read(InputStream in,
String charset)
throws IOException
in - InputStream to read from.charset - name of supported charset to use
IOException - in case of IO error
public static byte[] bytes(InputStream in)
throws IOException
in - InputStream to read from.
IOException - in case of IO error
public static byte[] read(File file)
throws IOException
file - file to read.
IOException
public static List<String> getResourceLines(String resourceName)
throws IOException
resourceName - name of resource
IOException - in case of IO errorpublic static boolean blank(Object value)
value - object to check.
public static String join(String[] collection,
String delimiter)
collection - - collection of items to join.delimiter - delimiter to insert between elements of collection.
public static String[] split(String input,
char delimiter)
input - string to split.delimiter - delimiter
public static String join(Collection collection,
String delimiter)
collection - - collection of items to join.delimiter - delimiter to insert between elements of collection.
public static void saveTo(String path,
InputStream in)
throws IOException
path - path to file.in - input stream to read content from.
IOExceptionpublic static String getStackTraceString(Throwable throwable)
throwable - - throwable to convert.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||