Package org.zeroturnaround.zip.commons
Class FileUtils
java.lang.Object
org.zeroturnaround.zip.commons.FileUtilsV2_2
org.zeroturnaround.zip.commons.FileUtils
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic void
copy
(File file, OutputStream out) Copies the given file into an output stream.static void
copy
(InputStream in, File file) Copies the given input stream into a file.static File
getTempFileFor
(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
-
Constructor Details
-
FileUtils
public FileUtils()Instances should NOT be constructed in standard programming.
-
-
Method Details
-
copy
Copies the given file into an output stream.- Parameters:
file
- input file (must exist).out
- output stream.- Throws:
IOException
- if file is not found or copying fails
-
copy
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:
IOException
- if file is not found or copying fails
-
getTempFileFor
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.
-