Package org.codehaus.plexus.archiver
Class AbstractUnArchiver
java.lang.Object
org.codehaus.plexus.archiver.AbstractUnArchiver
- All Implemented Interfaces:
FinalizerEnabled,UnArchiver
- Direct Known Subclasses:
AbstractZipUnArchiver,BZip2UnArchiver,GZipUnArchiver,SnappyUnArchiver,TarUnArchiver,XZUnArchiver,ZstdUnArchiver
- Author:
- Emmanuel Venisse
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArchiveFinalizer(ArchiveFinalizer finalizer) protected abstract voidexecute()protected abstract voidfinal voidextract()Extract the archive.final voidTake a path into the archive and extract it to the specified directory.protected voidextractFile(File srcF, File dir, InputStream compressedInputStream, String entryName, Date entryDate, boolean isDirectory, Integer mode, String symlinkDestination, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) org.codehaus.plexus.components.io.filemappers.FileMapper[]Get chain of components which rewrite the target path of each unpacked file.org.codehaus.plexus.components.io.fileselectors.FileSelector[]Returns a set ofFileSelectorinstances, which may be used to select the files to extract from the archive.protected org.slf4j.LoggerbooleanbooleanGets a flag indicating destination files are always overwritten.protected booleanisSelected(String fileName, org.codehaus.plexus.components.io.resources.PlexusIoResource fileInfo) booleanDeprecated.voidsetArchiveFinalizers(List<ArchiveFinalizer> archiveFinalizers) voidsetDestDirectory(File destDirectory) voidsetDestFile(File destFile) voidsetFileMappers(org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) Sets chain of components to be used for rewriting target path of each unpacked file.voidsetFileSelectors(org.codehaus.plexus.components.io.fileselectors.FileSelector[] fileSelectors) Sets a set ofFileSelectorinstances, which may be used to select the files to extract from the archive.voidsetIgnorePermissions(boolean ignorePermissions) voidsetOverwrite(boolean b) Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?voidsetSourceFile(File sourceFile) voidsetUseJvmChmod(boolean useJvmChmod) Deprecated.protected booleanshouldExtractEntry(File targetDirectory, File targetFileName, String entryName, Date entryDate) protected voidvalidate()protected void
-
Constructor Details
-
AbstractUnArchiver
public AbstractUnArchiver() -
AbstractUnArchiver
-
-
Method Details
-
getLogger
protected org.slf4j.Logger getLogger() -
getDestDirectory
- Specified by:
getDestDirectoryin interfaceUnArchiver
-
setDestDirectory
- Specified by:
setDestDirectoryin interfaceUnArchiver
-
getDestFile
- Specified by:
getDestFilein interfaceUnArchiver
-
setDestFile
- Specified by:
setDestFilein interfaceUnArchiver
-
getSourceFile
- Specified by:
getSourceFilein interfaceUnArchiver
-
setSourceFile
- Specified by:
setSourceFilein interfaceUnArchiver
-
isOverwrite
public boolean isOverwrite()Description copied from interface:UnArchiverGets a flag indicating destination files are always overwritten.- Specified by:
isOverwritein interfaceUnArchiver- Returns:
true, if destination files are overwritten, even if they are newer than the corresponding entry in the archive.
-
setOverwrite
public void setOverwrite(boolean b) Description copied from interface:UnArchiverShould we overwrite files in dest, even if they are newer than the corresponding entries in the archive?- Specified by:
setOverwritein interfaceUnArchiver
-
getFileMappers
public org.codehaus.plexus.components.io.filemappers.FileMapper[] getFileMappers()Description copied from interface:UnArchiverGet chain of components which rewrite the target path of each unpacked file.- Specified by:
getFileMappersin interfaceUnArchiver- Returns:
FileMappers to be used for rewriting each target path, ornullif no rewriting shall happen.
-
setFileMappers
public void setFileMappers(org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) Description copied from interface:UnArchiverSets chain of components to be used for rewriting target path of each unpacked file.- Specified by:
setFileMappersin interfaceUnArchiver- Parameters:
fileMappers-FileMapperto be used for rewriting each target path, ornullif no rewriting shall happen.
-
extract
Description copied from interface:UnArchiverExtract the archive.- Specified by:
extractin interfaceUnArchiver- Throws:
ArchiverException
-
extract
Description copied from interface:UnArchiverTake a path into the archive and extract it to the specified directory.- Specified by:
extractin interfaceUnArchiver- Parameters:
path- Path inside the archive to be extracted.outputDirectory- Directory to extract to.- Throws:
ArchiverException
-
addArchiveFinalizer
- Specified by:
addArchiveFinalizerin interfaceFinalizerEnabled
-
setArchiveFinalizers
- Specified by:
setArchiveFinalizersin interfaceFinalizerEnabled
-
validate
-
validate
- Throws:
ArchiverException
-
setFileSelectors
public void setFileSelectors(org.codehaus.plexus.components.io.fileselectors.FileSelector[] fileSelectors) Description copied from interface:UnArchiverSets a set ofFileSelectorinstances, which may be used to select the files to extract from the archive. If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors.- Specified by:
setFileSelectorsin interfaceUnArchiver
-
getFileSelectors
public org.codehaus.plexus.components.io.fileselectors.FileSelector[] getFileSelectors()Description copied from interface:UnArchiverReturns a set ofFileSelectorinstances, which may be used to select the files to extract from the archive. If file selectors are present, then a file is only extracted, if it is confirmed by all file selectors.- Specified by:
getFileSelectorsin interfaceUnArchiver
-
isSelected
protected boolean isSelected(String fileName, org.codehaus.plexus.components.io.resources.PlexusIoResource fileInfo) throws ArchiverException - Throws:
ArchiverException
-
execute
- Throws:
ArchiverException
-
execute
- Throws:
ArchiverException
-
isUseJvmChmod
Deprecated.- Specified by:
isUseJvmChmodin interfaceUnArchiver- Returns:
- Since:
- 1.1
-
setUseJvmChmod
Deprecated.jvm chmod won't set group level permissions !- Specified by:
setUseJvmChmodin interfaceUnArchiver- Parameters:
useJvmChmod-- Since:
- 1.1
-
isIgnorePermissions
public boolean isIgnorePermissions()- Specified by:
isIgnorePermissionsin interfaceUnArchiver- Since:
- 1.1
-
setIgnorePermissions
public void setIgnorePermissions(boolean ignorePermissions) - Specified by:
setIgnorePermissionsin interfaceUnArchiver- Since:
- 1.1
-
extractFile
protected void extractFile(File srcF, File dir, InputStream compressedInputStream, String entryName, Date entryDate, boolean isDirectory, Integer mode, String symlinkDestination, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) throws IOException, ArchiverException - Throws:
IOExceptionArchiverException
-
shouldExtractEntry
protected boolean shouldExtractEntry(File targetDirectory, File targetFileName, String entryName, Date entryDate) throws IOException - Throws:
IOException
-