|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.transaction.util.FileHelper
Helper methods for file manipulation. All methods are thread safe.
| Constructor Summary | |
FileHelper()
|
|
| Method Summary | |
static long |
copy(File input,
File output)
Copies one file to another using copy(InputStream, OutputStream). |
static long |
copy(File input,
File output,
byte[] copyBuffer)
Copies one file to another using the supplied buffer. |
static long |
copy(InputStream in,
File outputFile)
Copies an InputStream to a file using copy(InputStream, OutputStream). |
static long |
copy(InputStream in,
OutputStream out)
Copies an InputStream to an OutputStream using a local internal buffer for performance.
|
static long |
copy(InputStream in,
OutputStream out,
byte[] copyBuffer)
Copies an InputStream to an OutputStream using the specified buffer. |
static void |
copyRec(File source,
File target)
Copies one directory or file to another. |
static boolean |
createFile(String path)
Creates a file specified by a path. |
static boolean |
deleteFile(String path)
Deletes a file specified by a path. |
static boolean |
fileExists(String path)
Checks if a file specified by a path exits. |
static long |
globalBufferCopy(InputStream in,
OutputStream out)
Copies an InputStream to an OutputStream using a global internal buffer for performance.
|
static void |
moveRec(File source,
File target)
Moves one directory or file to another. |
static void |
removeRec(File toRemove)
Removes a file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileHelper()
| Method Detail |
public static boolean deleteFile(String path)
path - path of file to be deleted
true if file has been deleted, false otherwisepublic static boolean fileExists(String path)
path - path of file to be checked
true if file exists, false otherwise
public static boolean createFile(String path)
throws IOException
path - path of file to be created
true if file has been created, false if the file already exists
IOException - If an I/O error occurredpublic static void removeRec(File toRemove)
toRemove - file to be removed
public static void moveRec(File source,
File target)
throws IOException
source - file to move fromtarget - file to move to
IOException - if an I/O error occurs (may result in partially done work)
public static void copyRec(File source,
File target)
throws IOException
source - directory or file to copy fromtarget - directory or file to copy to
IOException - if an I/O error occurs (may result in partially done work)
public static long copy(File input,
File output)
throws IOException
copy(InputStream, OutputStream).
input - source fileoutput - destination file
IOException - if an I/O error occurs (may result in partially done work)copy(InputStream, OutputStream)
public static long copy(File input,
File output,
byte[] copyBuffer)
throws IOException
input - source fileoutput - destination filecopyBuffer - buffer used for copying
IOException - if an I/O error occurs (may result in partially done work)copy(InputStream, OutputStream)
public static long copy(InputStream in,
File outputFile)
throws IOException
InputStream to a file using copy(InputStream, OutputStream).
in - stream to copy fromoutputFile - file to copy to
IOException - if an I/O error occurs (may result in partially done work)copy(InputStream, OutputStream)
public static long copy(InputStream in,
OutputStream out)
throws IOException
InputStream to an OutputStream using a local internal buffer for performance.
Compared to globalBufferCopy(InputStream, OutputStream) this method allows for better
concurrency, but each time it is called generates a buffer which will be garbage.
in - stream to copy fromout - stream to copy to
IOException - if an I/O error occurs (may result in partially done work)globalBufferCopy(InputStream, OutputStream)
public static long globalBufferCopy(InputStream in,
OutputStream out)
throws IOException
InputStream to an OutputStream using a global internal buffer for performance.
Compared to copy(InputStream, OutputStream) this method generated no garbage,
but decreases concurrency.
in - stream to copy fromout - stream to copy to
IOException - if an I/O error occurs (may result in partially done work)copy(InputStream, OutputStream)
public static long copy(InputStream in,
OutputStream out,
byte[] copyBuffer)
throws IOException
InputStream to an OutputStream using the specified buffer.
in - stream to copy fromout - stream to copy tocopyBuffer - buffer used for copying
IOException - if an I/O error occurs (may result in partially done work)globalBufferCopy(InputStream, OutputStream),
copy(InputStream, OutputStream)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||