org.springframework.util
Class FileCopyUtils

java.lang.Object
  extended byorg.springframework.util.FileCopyUtils

public abstract class FileCopyUtils
extends java.lang.Object

Utility methods for file and stream copying. Mainly for use within the framework.

Since:
06.10.2003
Author:
Juergen Hoeller

Field Summary
static int BLOCK_SIZE
           
 
Constructor Summary
FileCopyUtils()
           
 
Method Summary
static void copy(byte[] in, java.io.File out)
          Copy the contents of the given byte array to the given output File.
static void copy(java.io.File in, java.io.File out)
          Copy the contents of the given input File to the given output File.
static void copy(java.io.InputStream in, java.io.OutputStream out)
          Copy the contents of the given InputStream to the given OutputStream.
static void copy(java.io.Reader in, java.io.Writer out)
          Copy the contents of the given InputStream to the given OutputStream.
static byte[] copyToByteArray(java.io.File in)
          Copy the contents of the given input File into a new byte array.
static byte[] copyToByteArray(java.io.InputStream in)
          Copy the contents of the given InputStream into a new byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCK_SIZE

public static final int BLOCK_SIZE
See Also:
Constant Field Values
Constructor Detail

FileCopyUtils

public FileCopyUtils()
Method Detail

copy

public static void copy(java.io.Reader in,
                        java.io.Writer out)
                 throws java.io.IOException
Copy the contents of the given InputStream to the given OutputStream. Closes both streams when done.

Parameters:
in - the stream to copy from
out - the stream to copy to
Throws:
java.io.IOException - in case of I/O errors

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out)
                 throws java.io.IOException
Copy the contents of the given InputStream to the given OutputStream. Closes both streams when done.

Parameters:
in - the stream to copy from
out - the stream to copy to
Throws:
java.io.IOException - in case of I/O errors

copy

public static void copy(java.io.File in,
                        java.io.File out)
                 throws java.io.IOException
Copy the contents of the given input File to the given output File.

Parameters:
in - the file to copy from
out - the file to copy to
Throws:
java.io.IOException - in case of I/O errors

copy

public static void copy(byte[] in,
                        java.io.File out)
                 throws java.io.IOException
Copy the contents of the given byte array to the given output File.

Parameters:
in - the byte array to copy from
out - the file to copy to
Throws:
java.io.IOException - in case of I/O errors

copyToByteArray

public static byte[] copyToByteArray(java.io.InputStream in)
                              throws java.io.IOException
Copy the contents of the given InputStream into a new byte array.

Parameters:
in - the stream to copy from
Returns:
the new byte array that has been copied to
Throws:
java.io.IOException - in case of I/O errors

copyToByteArray

public static byte[] copyToByteArray(java.io.File in)
                              throws java.io.IOException
Copy the contents of the given input File into a new byte array.

Parameters:
in - the file to copy from
Returns:
the new byte array that has been copied to
Throws:
java.io.IOException - in case of I/O errors


Copyright (C) 2003-2004 The Spring Framework Project.