public class IoUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static Charset |
ENCODING_CHARSET |
| Constructor and Description |
|---|
IoUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeSilently(Closeable closeable)
Close a closable ignoring any IO exception.
|
static byte[] |
fileAsByteArray(File file)
Returns the content of a
File. |
static InputStream |
fileAsStream(File file)
Returns the input stream of a file.
|
static InputStream |
fileAsStream(String filename)
Returns the input stream of a file with specified filename
|
static String |
fileAsString(File file)
Returns the content of a
File. |
static String |
fileAsString(String filename)
Returns the content of a file with specified filename
|
static File |
getClasspathFile(String filename)
Returns the
File for a filename. |
static File |
getClasspathFile(String filename,
ClassLoader classLoader)
Returns the
File for a filename. |
static byte[] |
inputStreamAsByteArray(InputStream inputStream)
Returns the input stream as
byte[]. |
static String |
inputStreamAsString(InputStream inputStream)
Returns the input stream as
String. |
static String |
readerAsString(Reader reader)
|
static InputStream |
stringAsInputStream(String string)
Returns the
String as InputStream. |
public static final Charset ENCODING_CHARSET
public static String inputStreamAsString(InputStream inputStream)
String.inputStream - the input streamString.public static byte[] inputStreamAsByteArray(InputStream inputStream)
byte[].inputStream - the input streambyte[].public static InputStream stringAsInputStream(String string)
String as InputStream.string - the String to convertInputStream containing the Stringpublic static void closeSilently(Closeable closeable)
closeable - the closable to closepublic static String fileAsString(String filename)
filename - name of the file to loadStringpublic static String fileAsString(File file)
File.file - the file to loadStringpublic static byte[] fileAsByteArray(File file)
File.file - the file to loadStringpublic static InputStream fileAsStream(String filename)
filename - the name of a File to loadIoUtilException - if the file cannot be loadedpublic static InputStream fileAsStream(File file)
file - the File to loadIoUtilException - if the file cannot be loadedpublic static File getClasspathFile(String filename)
File for a filename.filename - the filename to loadpublic static File getClasspathFile(String filename, ClassLoader classLoader)
File for a filename.filename - the filename to loadclassLoader - the classLoader to load file with, if null falls back to TCCL and then this class's classloaderIoUtilException - if the file cannot be loadedCopyright © 2018 Camunda Services GmbH. All rights reserved.