Package org.zeroturnaround.zip.commons
Class FileUtils
- java.lang.Object
-
- org.zeroturnaround.zip.commons.FileUtilsV2_2
-
- org.zeroturnaround.zip.commons.FileUtils
-
public class FileUtils extends FileUtilsV2_2
This class adds some convenience methods on top of Apache CommonsIO FileUtils. It exists so that the class it extends can contain code only from Apache Commons IO, which simplifies upgrades.
-
-
Field Summary
-
Fields inherited from class org.zeroturnaround.zip.commons.FileUtilsV2_2
EMPTY_FILE_ARRAY, ONE_EB, ONE_GB, ONE_KB, ONE_MB, ONE_PB, ONE_TB, ONE_YB, ONE_ZB
-
-
Constructor Summary
Constructors Constructor Description FileUtils()
Instances should NOT be constructed in standard programming.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
copy(java.io.File file, java.io.OutputStream out)
Copies the given file into an output stream.static void
copy(java.io.InputStream in, java.io.File file)
Copies the given input stream into a file.static java.io.File
getTempFileFor(java.io.File file)
Find a non-existing file in the same directory using the same name as prefix.-
Methods inherited from class org.zeroturnaround.zip.commons.FileUtilsV2_2
cleanDirectory, contentEquals, copyDirectory, copyDirectory, copyDirectory, copyFile, copyFile, copyFileToDirectory, copyFileToDirectory, deleteDirectory, deleteQuietly, forceDelete, forceDeleteOnExit, forceMkdir, isSymlink, moveDirectory, moveFile, openInputStream, openOutputStream, openOutputStream, readFileToString, readFileToString, sizeOf, sizeOfDirectory
-
-
-
-
Method Detail
-
copy
public static void copy(java.io.File file, java.io.OutputStream out) throws java.io.IOException
Copies the given file into an output stream.- Parameters:
file
- input file (must exist).out
- output stream.- Throws:
java.io.IOException
- if file is not found or copying fails
-
copy
public static void copy(java.io.InputStream in, java.io.File file) throws java.io.IOException
Copies the given input stream into a file.The target file must not be a directory and its parent must exist.
- Parameters:
in
- source stream.file
- output file to be created or overwritten.- Throws:
java.io.IOException
- if file is not found or copying fails
-
getTempFileFor
public static java.io.File getTempFileFor(java.io.File file)
Find a non-existing file in the same directory using the same name as prefix.- Parameters:
file
- file used for the name and location (it is not read or written).- Returns:
- a non-existing file in the same directory using the same name as prefix.
-
-