StreamUtils.
Mainly for use within the framework, but also useful for application code.
StreamUtils, FileSystemUtils
| Modifier and Type | Field and Description |
|---|---|
| public static final int | BUFFER_SIZE
The default buffer size used when copying bytes. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public static int | |
| public static void | |
| public static int | Returns: the number of bytes copiedthe stream to copy from in, OutputStream the stream to copy to out)Copy the contents of the given InputStream to the given OutputStream. |
| public static void | copy(byte[]
the byte array to copy from in, OutputStream the OutputStream to copy to out)Copy the contents of the given byte array to the given OutputStream. |
| public static int | |
| public static void | |
| public static byte[] | Returns: the new byte array that has been copied tothe file to copy from in)Copy the contents of the given input File into a new byte array. |
| public static byte[] | Returns: the new byte array that has been copied to (possibly empty)the stream to copy from (may be in)null or empty)Copy the contents of the given InputStream into a new byte array. |
| public static String | Returns: the String that has been copied to (possibly empty)the reader to copy from (may be in)null or empty)Copy the contents of the given Reader into a String. |
| BUFFER_SIZE | back to summary |
|---|---|
| public static final int BUFFER_SIZE The default buffer size used when copying bytes. | |
| FileCopyUtils | back to summary |
|---|---|
| public FileCopyUtils() | |
| close | back to summary |
|---|---|
| private static void close(Closeable closeable) Attempt to close the supplied
| |
| copy | back to summary |
|---|---|
| public static int copy(File in, File out) throws IOException Copy the contents of the given input File to the given output File.
| |
| copy | back to summary |
|---|---|
| public static void copy(byte[] in, File out) throws IOException Copy the contents of the given byte array to the given output File.
| |
| copy | back to summary |
|---|---|
| public static int copy(InputStream in, OutputStream out) throws IOException Copy the contents of the given InputStream to the given OutputStream. Closes both streams when done.
| |
| copy | back to summary |
|---|---|
| public static void copy(byte[] in, OutputStream out) throws IOException Copy the contents of the given byte array to the given OutputStream. Closes the stream when done.
| |
| copy | back to summary |
|---|---|
| public static int copy(Reader in, Writer out) throws IOException Copy the contents of the given Reader to the given Writer. Closes both when done.
| |
| copy | back to summary |
|---|---|
| public static void copy(String in, Writer out) throws IOException Copy the contents of the given String to the given Writer. Closes the writer when done.
| |
| copyToByteArray | back to summary |
|---|---|
| public static byte[] copyToByteArray(File in) throws IOException Copy the contents of the given input File into a new byte array.
| |
| copyToByteArray | back to summary |
|---|---|
| public static byte[] copyToByteArray(InputStream in) throws IOException Copy the contents of the given InputStream into a new byte array. Closes the stream when done.
| |
| copyToString | back to summary |
|---|---|
| public static String copyToString(Reader in) throws IOException Copy the contents of the given Reader into a String. Closes the reader when done.
| |