| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.util.FileCopyUtils
public abstract class FileCopyUtils
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.
Mainly for use within the framework, but also useful for application code.
| Field Summary | |
|---|---|
static int | 
BUFFER_SIZE
 | 
| Constructor Summary | |
|---|---|
FileCopyUtils()
 | 
|
| Method Summary | |
|---|---|
static void | 
copy(byte[] in,
     File out)
Copy the contents of the given byte array to the given output File.  | 
static void | 
copy(byte[] in,
     OutputStream out)
Copy the contents of the given byte array to the given OutputStream.  | 
static int | 
copy(File in,
     File out)
Copy the contents of the given input File to the given output File.  | 
static int | 
copy(InputStream in,
     OutputStream out)
Copy the contents of the given InputStream to the given OutputStream.  | 
static int | 
copy(Reader in,
     Writer out)
Copy the contents of the given Reader to the given Writer.  | 
static void | 
copy(String in,
     Writer out)
Copy the contents of the given String to the given output Writer.  | 
static byte[] | 
copyToByteArray(File in)
Copy the contents of the given input File into a new byte array.  | 
static byte[] | 
copyToByteArray(InputStream in)
Copy the contents of the given InputStream into a new byte array.  | 
static String | 
copyToString(Reader in)
Copy the contents of the given Reader into a String.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int BUFFER_SIZE
| Constructor Detail | 
|---|
public FileCopyUtils()
| Method Detail | 
|---|
public static int copy(File in,
                       File out)
                throws IOException
in - the file to copy fromout - the file to copy to
IOException - in case of I/O errors
public static void copy(byte[] in,
                        File out)
                 throws IOException
in - the byte array to copy fromout - the file to copy to
IOException - in case of I/O errors
public static byte[] copyToByteArray(File in)
                              throws IOException
in - the file to copy from
IOException - in case of I/O errors
public static int copy(InputStream in,
                       OutputStream out)
                throws IOException
in - the stream to copy fromout - the stream to copy to
IOException - in case of I/O errors
public static void copy(byte[] in,
                        OutputStream out)
                 throws IOException
in - the byte array to copy fromout - the OutputStream to copy to
IOException - in case of I/O errors
public static byte[] copyToByteArray(InputStream in)
                              throws IOException
in - the stream to copy from
IOException - in case of I/O errors
public static int copy(Reader in,
                       Writer out)
                throws IOException
in - the Reader to copy fromout - the Writer to copy to
IOException - in case of I/O errors
public static void copy(String in,
                        Writer out)
                 throws IOException
in - the String to copy fromout - the Writer to copy to
IOException - in case of I/O errors
public static String copyToString(Reader in)
                           throws IOException
in - the reader to copy from
IOException - in case of I/O errors
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||