|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ikrs.io.fileio.FileCopy
public class FileCopy
The standard java libraries have no file- and directory- copy routines. This class is a simple solution.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size to use (in bytes). |
Constructor Summary | |
---|---|
FileCopy()
|
Method Summary | |
---|---|
static boolean |
copy(java.io.File source,
java.io.File destination)
Copy the data from source to destination. |
static void |
main(java.lang.String[] argv)
For testing purposes only. |
static long |
transfer(java.io.File sourceFile,
java.io.File destinationFile,
int bufferSize)
Transfer all bytes from the given input file into the destination output file (non of the files must be a directory). |
static long |
transfer(java.io.InputStream source,
java.io.OutputStream destination,
int bufferSize)
Transfer all bytes from the given input stream into the destination output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public FileCopy()
Method Detail |
---|
public static boolean copy(java.io.File source, java.io.File destination) throws java.lang.NullPointerException, java.io.IOException
java.lang.NullPointerException
java.io.IOException
public static long transfer(java.io.File sourceFile, java.io.File destinationFile, int bufferSize) throws java.lang.NullPointerException, java.lang.IllegalArgumentException, java.io.IOException
sourceFile
- The input file to read from.destinationFile
- The output file to write to.bufferSize
- The buffer size to use (a value from 512 to 2048 should be okay for most purposes).
java.lang.NullPointerException
- If sourceFile or destinationFile is null.
java.lang.IllegalArgumentException
- If the buffer size is not in range (must be > 0).
java.io.IOException
- If any IO errors occur.public static long transfer(java.io.InputStream source, java.io.OutputStream destination, int bufferSize) throws java.lang.NullPointerException, java.lang.IllegalArgumentException, java.io.IOException
source
- The input stream to read from.destination
- The output stream to write to.bufferSize
- The buffer size to use (a value from 512 to 2048 should be okay for most purposes).
java.lang.NullPointerException
- If source or destination is null.
java.lang.IllegalArgumentException
- If the buffer size is not in range (must be > 0).
java.io.IOException
- If any IO errors occur.public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |