Class ArchiveUtilsKt
-
- All Implemented Interfaces:
public final class ArchiveUtilsKt
-
-
Method Summary
Modifier and Type Method Description final static Unitunpack(File $self, File targetDirectory, ArchiveType forceArchiveType, Function1<ArchiveEntry, Boolean> filter)Unpack the File to targetDirectory using filter to select only the entries of interest. final static UnitunpackTryAllTypes(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)Try to unpack this File of an unknown archive type to targetDirectory using filter to select only the entries of interest. final static Unitunpack7Zip(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)Unpack the File assuming it is a 7-Zip archive. final static <Error class: unknown class>unpackZip(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)Unpack the File assuming it is a Zip archive ignoring all entries not matched by filter. final static <Error class: unknown class>unpackZip(InputStream $self, File targetDirectory)Unpack the InputStream to targetDirectory assuming that it is a ZIP archive. final static UnitunpackDeb(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)Unpack the File assuming it is a Debian archive. final static <Error class: unknown class>unpackTar(InputStream $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)Unpack the InputStream to targetDirectory assuming that it is a tape archive (TAR). final static FilepackZip(File $self, File targetFile, String prefix, Boolean overwrite, Function1<File, Boolean> directoryFilter, Function1<File, Boolean> fileFilter)Pack the file into a ZIP targetFile using Deflater.BEST_COMPRESSION. -
-
Method Detail
-
unpack
final static Unit unpack(File $self, File targetDirectory, ArchiveType forceArchiveType, Function1<ArchiveEntry, Boolean> filter)
Unpack the File to targetDirectory using filter to select only the entries of interest. If an archive type other than ArchiveType.NONE is specified in forceArchiveType, use this one; otherwise, try to detect the type based on the file extension. Throw an IOException if unpacking fails.
-
unpackTryAllTypes
final static Unit unpackTryAllTypes(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)
Try to unpack this File of an unknown archive type to targetDirectory using filter to select only the entries of interest. Use the file name to guess the archive type. If this is not possible due to a missing or unknown file extension, try out the supported archive types one after the other.
-
unpack7Zip
final static Unit unpack7Zip(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)
Unpack the File assuming it is a 7-Zip archive. This implementation ignores empty directories and symbolic links and all entries not matched by the given filter.
-
unpackZip
final static <Error class: unknown class> unpackZip(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)
Unpack the File assuming it is a Zip archive ignoring all entries not matched by filter.
-
unpackZip
final static <Error class: unknown class> unpackZip(InputStream $self, File targetDirectory)
Unpack the InputStream to targetDirectory assuming that it is a ZIP archive. This implementation ignores empty directories and symbolic links.
-
unpackDeb
final static Unit unpackDeb(File $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)
Unpack the File assuming it is a Debian archive. The nested top-level "data" and "control" TAR archives are unpacked to the provided targetDirectory into subdirectories of the respective names. The filter function is applied to the contents of the TAR archives so that ArchiveEntrys that do not match are ignored.
-
unpackTar
final static <Error class: unknown class> unpackTar(InputStream $self, File targetDirectory, Function1<ArchiveEntry, Boolean> filter)
Unpack the InputStream to targetDirectory assuming that it is a tape archive (TAR). This implementation ignores empty directories and symbolic links and all archive entries not accepted by filter.
-
packZip
final static File packZip(File $self, File targetFile, String prefix, Boolean overwrite, Function1<File, Boolean> directoryFilter, Function1<File, Boolean> fileFilter)
Pack the file into a ZIP targetFile using Deflater.BEST_COMPRESSION. If the file is a directory its content is recursively added to the archive. Only regular files are added, e.g. symbolic links or directories are skipped. If a prefix is specified, it is added to the file names in the ZIP file. If not all directories or files shall be added to the archive a directoryFilter or fileFilter can be provided. By default, VCS directories are skipped. Return the targetFile for convenience.
-
-
-
-