| java.lang.Object org.apache.commons.transaction.util.FileHelper
FileHelper | final public class FileHelper (Code) | | Helper methods for file manipulation.
All methods are thread safe.
version: $Id: FileHelper.java 493628 2007-01-07 01:42:48Z joerg $ |
Method Summary | |
public static long | copy(File input, File output) Copies one file to another using
FileHelper.copy(InputStream,OutputStream) . | public static long | copy(File input, File output, byte[] copyBuffer) Copies one file to another using the supplied buffer. | public static long | copy(InputStream in, File outputFile) Copies an InputStream to a file using
FileHelper.copy(InputStream,OutputStream) . | public static long | copy(InputStream in, OutputStream out) Copies an InputStream to an OutputStream using a local internal buffer for performance. | public static long | copy(InputStream in, OutputStream out, byte[] copyBuffer) Copies an InputStream to an OutputStream using the specified buffer. | public static void | copyRec(File source, File target) Copies one directory or file to another. | static void | copyRec(File source, File target, byte[] sharedBuffer) | public static boolean | createFile(String path) Creates a file specified by a path. | public static boolean | deleteFile(String path) Deletes a file specified by a path. | public static boolean | fileExists(String path) Checks if a file specified by a path exits. | public static long | globalBufferCopy(InputStream in, OutputStream out) Copies an InputStream to an OutputStream using a global internal buffer for performance. | public static void | moveRec(File source, File target) Moves one directory or file to another. | static void | moveRec(File source, File target, byte[] sharedBuffer) | public static void | removeRec(File toRemove) Removes a file. |
copy | public static long copy(File input, File output, byte[] copyBuffer) throws IOException(Code) | | Copies one file to another using the supplied buffer.
Parameters: input - source file Parameters: output - destination file Parameters: copyBuffer - buffer used for copying the number of bytes copied throws: IOException - if an I/O error occurs (may result in partially done work) See Also: FileHelper.copy(InputStream,OutputStream) |
copyRec | public static void copyRec(File source, File target) throws IOException(Code) | | Copies one directory or file to another. Existing files will be replaced.
Parameters: source - directory or file to copy from Parameters: target - directory or file to copy to throws: IOException - if an I/O error occurs (may result in partially done work) |
createFile | public static boolean createFile(String path) throws IOException(Code) | | Creates a file specified by a path. All necessary directories will be created.
Parameters: path - path of file to be created true if file has been created, false if the file already exists throws: IOException - If an I/O error occurred |
deleteFile | public static boolean deleteFile(String path)(Code) | | Deletes a file specified by a path.
Parameters: path - path of file to be deleted true if file has been deleted, false otherwise |
fileExists | public static boolean fileExists(String path)(Code) | | Checks if a file specified by a path exits.
Parameters: path - path of file to be checked true if file exists, false otherwise |
moveRec | public static void moveRec(File source, File target) throws IOException(Code) | | Moves one directory or file to another. Existing files will be replaced.
Parameters: source - file to move from Parameters: target - file to move to throws: IOException - if an I/O error occurs (may result in partially done work) |
removeRec | public static void removeRec(File toRemove)(Code) | | Removes a file. If the specified file is a directory all contained files will
be removed recursively as well.
Parameters: toRemove - file to be removed |
|
|