public final class IOUtils extends Object
| Constructor and Description |
|---|
IOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeIgnoringException(Closeable closeable)
Closes Closeable instance ignoring IOException.
|
static void |
main(String[] a) |
static byte[] |
readBytes(InputStream in) |
static byte[] |
readFileAtOnce(File file)
Reads the contents of the file at once and returns the byte array.
|
static byte[] |
readFileAtOnce(String filename)
Reads the contents of the file at once and returns the byte array.
|
static String |
readFileAtOnceAsString(File file)
Reads a file and returns the contents as string.
|
static String |
readFileAtOnceAsString(String filename)
Reads a file and returns the contents as string.
|
static String |
readFileBufferedAsString(File file,
String charset) |
static String |
readFileBufferedAsString(String filename)
Instead of reading the file at once, reads the file by reading 2K blocks.
|
static String |
readInputStreamBufferedAsString(InputStream in,
String charset) |
static String |
readlineFromStdIn()
Reads a line from standard input.
|
public static final byte[] readFileAtOnce(File file) throws IOException
file - IOExceptionpublic static final byte[] readFileAtOnce(String filename) throws IOException
filename - name of the file.IOExceptionpublic static final String readFileAtOnceAsString(String filename) throws IOException
filename - IOExceptionpublic static final String readFileAtOnceAsString(File file) throws IOException
file - IOExceptionpublic static final String readFileBufferedAsString(String filename) throws IOException
filename - IOExceptionpublic static final String readInputStreamBufferedAsString(InputStream in, String charset) throws IOException
IOExceptionpublic static final String readFileBufferedAsString(File file, String charset) throws IOException
IOExceptionpublic static String readlineFromStdIn() throws IOException
IOExceptionpublic static void closeIgnoringException(Closeable closeable)
closeable - to closepublic static byte[] readBytes(InputStream in) throws IOException
IOExceptionCopyright © 2010-2014 anotheria.net. All Rights Reserved.