| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static void | closeSilently(AutoCloseable
the AutoCloseable or null out)Close an AutoCloseable without throwing an exception. |
| public static long | Returns: the number of bytes copiedthe input stream in, OutputStream the output stream (null if writing is not required) out)Copy all data from the input stream to the output stream. |
| public static long | Returns: the number of bytes copiedthe input stream in, OutputStream the output stream (null if writing is not required) out, long the maximum number of bytes to copy length)Copy all data from the input stream to the output stream. |
| public static long | Returns: the number of bytes copiedthe input FileChannel in, OutputStream the output stream (null if writing is not required) out)Copy all data from the input FileChannel to the output stream. |
| public static long | Returns: the number of bytes copiedthe input FileChannel in, OutputStream the output stream (null if writing is not required) out, long the maximum number of bytes to copy length)Copy all data from the input FileChannel to the output stream. |
| public static long | Returns: the number of bytes copiedthe input stream in, OutputStream the output stream out)Copy all data from the input stream to the output stream and close both streams. |
| public static long | Returns: the number of bytes copiedthe input stream in, OutputStream the output stream (null if writing is not required) out)Copy all data from the input stream to the output stream and close the input stream. |
| public static long | Returns: the number of characters copiedthe reader in, Writer the writer (null if writing is not required) out, long the maximum number of bytes to copy length)Copy all data from the reader to the writer and close the reader. |
| public static void | |
| public static Reader | |
| public static Writer | Returns: the writerthe output stream or null out)Create a buffered writer to write to an output stream using the UTF-8 format. |
| public static InputStream | Returns: the input streamthe string s)Create an input stream to read from a string. |
| public static Reader | Returns: the readerthe input stream or null in)Create a reader to read from an input stream using the UTF-8 format. |
| public static String | Returns: path with converted separatorspath to convert path)Converts / and \ name separators in path to native separators. |
| public static byte[] | Returns: the bytes readthe input stream in, int the maximum number of bytes to read, or -1 to read until
the end of file length)Read a number of bytes from an input stream and close the stream. |
| public static int | Returns: the number of bytes read, 0 meaning EOFthe input stream in, byte[] the output buffer buffer, int the number of bytes to read at most max)Try to read the given number of bytes to the buffer. |
| public static int | |
| public static String | Returns: the string readthe reader in, int the maximum number of characters to read, or -1 to read
until the end of file length)Read a number of characters from a reader and close it. |
| public static void | skipFully(InputStream
the input stream in, long the number of bytes to skip skip)Skip a number of bytes in an input stream. |
| public static void | |
| public static void |
| IOUtils | back to summary |
|---|---|
| private IOUtils() | |
| closeSilently | back to summary |
|---|---|
| public static void closeSilently(AutoCloseable out) Close an AutoCloseable without throwing an exception.
| |
| copy | back to summary |
|---|---|
| public static long copy(InputStream in, OutputStream out) throws IOException Copy all data from the input stream to the output stream. Both streams are kept open.
| |
| copy | back to summary |
|---|---|
| public static long copy(InputStream in, OutputStream out, long length) throws IOException Copy all data from the input stream to the output stream. Both streams are kept open.
| |
| copy | back to summary |
|---|---|
| public static long copy(FileChannel in, OutputStream out) throws IOException Copy all data from the input FileChannel to the output stream. Both source and destination are kept open.
| |
| copy | back to summary |
|---|---|
| public static long copy(FileChannel in, OutputStream out, long length) throws IOException Copy all data from the input FileChannel to the output stream. Both source and destination are kept open.
| |
| copyAndClose | back to summary |
|---|---|
| public static long copyAndClose(InputStream in, OutputStream out) throws IOException Copy all data from the input stream to the output stream and close both streams. Exceptions while closing are ignored.
| |
| copyAndCloseInput | back to summary |
|---|---|
| public static long copyAndCloseInput(InputStream in, OutputStream out) throws IOException Copy all data from the input stream to the output stream and close the input stream. Exceptions while closing are ignored.
| |
| copyAndCloseInput | back to summary |
|---|---|
| public static long copyAndCloseInput(Reader in, Writer out, long length) throws IOException Copy all data from the reader to the writer and close the reader. Exceptions while closing are ignored.
| |
| copyFiles | back to summary |
|---|---|
| public static void copyFiles(String original, String copy) throws IOException Copy a file from one directory to another, or to another file.
| |
| getAsciiReader | back to summary |
|---|---|
| public static Reader getAsciiReader(InputStream in) Wrap an input stream in a reader. The bytes are converted to characters using the US-ASCII character set.
| |
| getBufferedWriter | back to summary |
|---|---|
| public static Writer getBufferedWriter(OutputStream out) Create a buffered writer to write to an output stream using the UTF-8 format. If the output stream is null, this method returns null.
| |
| getInputStreamFromString | back to summary |
|---|---|
| public static InputStream getInputStreamFromString(String s) Create an input stream to read from a string. The string is converted to a byte array using UTF-8 encoding. If the string is null, this method returns null.
| |
| getReader | back to summary |
|---|---|
| public static Reader getReader(InputStream in) Create a reader to read from an input stream using the UTF-8 format. If the input stream is null, this method returns null. The InputStreamReader that is used here is not exact, that means it may read some additional bytes when buffering.
| |
| nameSeparatorsToNative | back to summary |
|---|---|
| public static String nameSeparatorsToNative(String path) Converts / and \ name separators in path to native separators. | |
| readBytesAndClose | back to summary |
|---|---|
| public static byte[] readBytesAndClose(InputStream in, int length) throws IOException Read a number of bytes from an input stream and close the stream.
| |
| readFully | back to summary |
|---|---|
| public static int readFully(InputStream in, byte[] buffer, int max) throws IOException Try to read the given number of bytes to the buffer. This method reads until the maximum number of bytes have been read or until the end of file.
| |
| readFully | back to summary |
|---|---|
| public static int readFully(Reader in, char[] buffer, int max) throws IOException Try to read the given number of characters to the buffer. This method reads until the maximum number of characters have been read or until the end of file.
| |
| readStringAndClose | back to summary |
|---|---|
| public static String readStringAndClose(Reader in, int length) throws IOException Read a number of characters from a reader and close it.
| |
| skipFully | back to summary |
|---|---|
| public static void skipFully(InputStream in, long skip) throws IOException Skip a number of bytes in an input stream.
| |
| skipFully | back to summary |
|---|---|
| public static void skipFully(Reader reader, long skip) throws IOException Skip a number of characters in a reader.
| |
| trace | back to summary |
|---|---|
| public static void trace(String method, String fileName, Object o) Trace input or output operations if enabled. | |