public class IoUtil extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG
Controls if intermediate results are written to files.
|
static String |
DEBUG_DIR
Directory, into which intermediate results are written.
|
Constructor and Description |
---|
IoUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
closeSilently(InputStream... streams) |
static void |
closeSilently(InputStream inputStream)
Closes the given stream.
|
static void |
closeSilently(OutputStream... streams) |
static void |
closeSilently(OutputStream outputStream)
Closes the given stream.
|
static int |
copyBytes(InputStream in,
OutputStream out) |
static File |
getFile(String filePath) |
static InputStream |
readFileAsInputStream(String absoluteClassPath) |
static String |
readFileAsString(String filePath) |
static byte[] |
readInputStream(InputStream inputStream,
String inputStreamName) |
static InputStream |
toInputStream(String result,
String encoding)
Returns an input stream serving the given argument
|
static String |
toString(InputStream input) |
static String |
toString(InputStream input,
String encoding) |
static void |
writeStringToFile(String content,
String filePath) |
static void |
writeStringToFileIfDebug(String content,
String filename,
String suffix) |
public static boolean DEBUG
public static String DEBUG_DIR
public static byte[] readInputStream(InputStream inputStream, String inputStreamName)
public static InputStream readFileAsInputStream(String absoluteClassPath)
public static void writeStringToFileIfDebug(String content, String filename, String suffix)
public static void closeSilently(InputStream inputStream)
InputStream.close()
, but
errors while closing are silently ignored.public static void closeSilently(InputStream... streams)
public static void closeSilently(OutputStream outputStream)
OutputStream.close()
, but
errors while closing are silently ignored.public static void closeSilently(OutputStream... streams)
public static int copyBytes(InputStream in, OutputStream out) throws IOException
IOException
public static String toString(InputStream input) throws IOException
IOException
public static String toString(InputStream input, String encoding) throws IOException
IOException
public static InputStream toInputStream(String result, String encoding)
result
- encoding
- Copyright © 2015. All rights reserved.