| java.lang.Object org.compass.core.util.CopyUtils
CopyUtils | abstract public class CopyUtils (Code) | | Simple utility methods for file and stream copying.
All copy methods use a block size of 4096 bytes,
and close all affected streams when done.
author: kimhcy |
Method Summary | |
public static int | copy(File in, File out) Copy the contents of the given input File to the given output File. | public static void | copy(byte[] in, File out) Copy the contents of the given byte array to the given output File. | public static int | copy(InputStream in, OutputStream out) Copy the contents of the given InputStream to the given OutputStream. | public static void | copy(byte[] in, OutputStream out) Copy the contents of the given byte array to the given OutputStream. | public static int | copy(Reader in, Writer out) Copy the contents of the given Reader to the given Writer. | public static void | copy(String in, Writer out) Copy the contents of the given String to the given output Writer. | public static byte[] | copyToByteArray(File in) Copy the contents of the given input File into a new byte array. | public static byte[] | copyToByteArray(InputStream in) Copy the contents of the given InputStream into a new byte array. | public static String | copyToString(Reader in) Copy the contents of the given Reader into a String. |
BUFFER_SIZE | final public static int BUFFER_SIZE(Code) | | |
copy | public static int copy(File in, File out) throws IOException(Code) | | Copy the contents of the given input File to the given output File.
Parameters: in - the file to copy from Parameters: out - the file to copy to the number of bytes copied throws: IOException - in case of I/O errors |
copy | public static void copy(byte[] in, File out) throws IOException(Code) | | Copy the contents of the given byte array to the given output File.
Parameters: in - the byte array to copy from Parameters: out - the file to copy to throws: IOException - in case of I/O errors |
copy | public static int copy(InputStream in, OutputStream out) throws IOException(Code) | | Copy the contents of the given InputStream to the given OutputStream.
Closes both streams when done.
Parameters: in - the stream to copy from Parameters: out - the stream to copy to the number of bytes copied throws: IOException - in case of I/O errors |
copy | public static void copy(byte[] in, OutputStream out) throws IOException(Code) | | Copy the contents of the given byte array to the given OutputStream.
Closes the stream when done.
Parameters: in - the byte array to copy from Parameters: out - the OutputStream to copy to throws: IOException - in case of I/O errors |
copy | public static int copy(Reader in, Writer out) throws IOException(Code) | | Copy the contents of the given Reader to the given Writer.
Closes both when done.
Parameters: in - the Reader to copy from Parameters: out - the Writer to copy to the number of characters copied throws: IOException - in case of I/O errors |
copy | public static void copy(String in, Writer out) throws IOException(Code) | | Copy the contents of the given String to the given output Writer.
Closes the write when done.
Parameters: in - the String to copy from Parameters: out - the Writer to copy to throws: IOException - in case of I/O errors |
copyToByteArray | public static byte[] copyToByteArray(File in) throws IOException(Code) | | Copy the contents of the given input File into a new byte array.
Parameters: in - the file to copy from the new byte array that has been copied to throws: IOException - in case of I/O errors |
copyToByteArray | public static byte[] copyToByteArray(InputStream in) throws IOException(Code) | | Copy the contents of the given InputStream into a new byte array.
Closes the stream when done.
Parameters: in - the stream to copy from the new byte array that has been copied to throws: IOException - in case of I/O errors |
copyToString | public static String copyToString(Reader in) throws IOException(Code) | | Copy the contents of the given Reader into a String.
Closes the reader when done.
Parameters: in - the reader to copy from the String that has been copied to throws: IOException - in case of I/O errors |
|
|