Package de.julielab.java.utilities
Class CompressionUtilities
- java.lang.Object
-
- de.julielab.java.utilities.CompressionUtilities
-
public class CompressionUtilities extends Object
Utility class to work with compressed files. Note that the dependency for the jarchivelib project is set with scope provided. Thus, the dependency will not automatically be introduced into a project depending on this project. This is done to keep transitive dependencies at a minimum.
-
-
Constructor Summary
Constructors Constructor Description CompressionUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Fileextract(File from, File to, boolean deleteArchive)Extracts the given file into the given directory.static Iterator<InputStream>getArchiveEntryInputStreams(File archive)
-
-
-
Method Detail
-
extract
public static File extract(File from, File to, boolean deleteArchive) throws IOException
Extracts the given file into the given directory. Returns a file to the extraction point of the first archive entry. This is for convenience if the archive contains a directory for quick access. The archive format is automatically determined by the underlying (de)compression library.- Parameters:
from- An archive file.to- The directory to extract the archive to.deleteArchive- Whether the archive file should be deleted after extraction.- Returns:
- The path to the extracted first entry of the archive.
- Throws:
IOException- If the archive cannot be read or files cannot be created or deleted.
-
getArchiveEntryInputStreams
public static Iterator<InputStream> getArchiveEntryInputStreams(File archive) throws IOException
- Throws:
IOException
-
-