Package org.codehaus.plexus.archiver.tar
Class TarArchiver
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.plexus.archiver.AbstractArchiver
-
- org.codehaus.plexus.archiver.tar.TarArchiver
-
- All Implemented Interfaces:
Archiver,FinalizerEnabled,org.codehaus.plexus.logging.LogEnabled,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
public class TarArchiver extends AbstractArchiver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTarArchiver.TarCompressionMethodValid Modes for Compression attribute to Tar TaskclassTarArchiver.TarOptionsValid Modes for Compression attribute to Tar Task
-
Field Summary
Fields Modifier and Type Field Description private TarArchiver.TarCompressionMethodcompressionprivate TarLongFileModelongFileModeprivate booleanlongWarningGivenIndicates whether the user has been warned about long files already.private TarArchiver.TarOptionsoptionsprivate org.apache.commons.compress.archivers.tar.TarArchiveOutputStreamtOut-
Fields inherited from interface org.codehaus.plexus.archiver.Archiver
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DEFAULT_SYMLILNK_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS, ROLE
-
-
Constructor Summary
Constructors Constructor Description TarArchiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanUp()protected voidclose()private java.io.OutputStreamcompress(TarArchiver.TarCompressionMethod tarCompressionMethod, java.io.OutputStream ostream)protected voidexecute()protected java.lang.StringgetArchiveType()booleanisSupportingForced()Returns, whether the archive supports uptodate checks.voidsetCompression(TarArchiver.TarCompressionMethod mode)Set compression method.voidsetLongfile(TarLongFileMode mode)Set how to handle long files, those with a path>100 chars.protected voidtarFile(ArchiveEntry entry, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tOut, java.lang.String vPath)tar a file-
Methods inherited from class org.codehaus.plexus.archiver.AbstractArchiver
addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchiveFinalizer, addDirectory, addDirectory, addDirectory, addDirectory, addFile, addFile, addFileSet, addResource, addResources, addSymlink, addSymlink, asArchiveEntry, asResourceCollection, checkForced, configureReproducible, contextualize, createArchive, getDefaultDirectoryMode, getDefaultFileMode, getDestFile, getDirectoryMode, getDuplicateBehavior, getFileMode, getFilenameComparator, getFiles, getIncludeEmptyDirs, getLastModifiedDate, getLogger, getOverrideDirectoryMode, getOverrideFileMode, getOverrideGid, getOverrideGroupName, getOverrideUid, getOverrideUserName, getRawDefaultFileMode, getResources, hasVirtualFiles, isForced, isIgnorePermissions, isUptodate, isUseJvmChmod, normalizeLastModifiedDate, postCreateArchive, revert, runArchiveFinalizers, setArchiveFinalizers, setDefaultDirectoryMode, setDefaultFileMode, setDestFile, setDirectoryMode, setDotFileDirectory, setDuplicateBehavior, setFileMode, setFilenameComparator, setForced, setIgnorePermissions, setIncludeEmptyDirs, setLastModifiedDate, setOverrideGid, setOverrideGroupName, setOverrideUid, setOverrideUserName, setUseJvmChmod, validate
-
-
-
-
Field Detail
-
longWarningGiven
private boolean longWarningGiven
Indicates whether the user has been warned about long files already.
-
longFileMode
private TarLongFileMode longFileMode
-
compression
private TarArchiver.TarCompressionMethod compression
-
options
private TarArchiver.TarOptions options
-
tOut
private org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tOut
-
-
Method Detail
-
setLongfile
public void setLongfile(TarLongFileMode mode)
Set how to handle long files, those with a path>100 chars. Optional, default=warn.Allowable values are
- truncate - paths are truncated to the maximum length
- fail - paths greater than the maximum cause a build exception
- warn - paths greater than the maximum cause a warning and GNU is used
- gnu - GNU extensions are used for any paths greater than the maximum.
- posix - posix extensions are used for any paths greater than the maximum.
- posixwarn - posix extensions are used (with warning) for any paths greater than the maximum.
- omit - paths greater than the maximum are omitted from the archive
- Parameters:
mode- the mode to handle long file names.
-
setCompression
public void setCompression(TarArchiver.TarCompressionMethod mode)
Set compression method. Allowable values are- none - no compression
- gzip - Gzip compression
- bzip2 - Bzip2 compression
- Parameters:
mode- the compression method.
-
execute
protected void execute() throws ArchiverException, java.io.IOException- Specified by:
executein classAbstractArchiver- Throws:
ArchiverExceptionjava.io.IOException
-
tarFile
protected void tarFile(ArchiveEntry entry, org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tOut, java.lang.String vPath) throws ArchiverException, java.io.IOException
tar a file- Parameters:
entry- the file to tartOut- the output streamvPath- the path name of the file to tar- Throws:
java.io.IOException- on errorArchiverException
-
compress
private java.io.OutputStream compress(TarArchiver.TarCompressionMethod tarCompressionMethod, java.io.OutputStream ostream) throws java.io.IOException
- Throws:
java.io.IOException
-
isSupportingForced
public boolean isSupportingForced()
Description copied from interface:ArchiverReturns, whether the archive supports uptodate checks. If so, you may setArchiver.setForced(boolean)to true.- Specified by:
isSupportingForcedin interfaceArchiver- Overrides:
isSupportingForcedin classAbstractArchiver- Returns:
- true, if the archiver does support uptodate checks, false otherwise
- See Also:
Archiver.setForced(boolean),Archiver.isForced()
-
cleanUp
protected void cleanUp() throws java.io.IOException- Overrides:
cleanUpin classAbstractArchiver- Throws:
java.io.IOException
-
close
protected void close() throws java.io.IOException- Specified by:
closein classAbstractArchiver- Throws:
java.io.IOException
-
getArchiveType
protected java.lang.String getArchiveType()
- Specified by:
getArchiveTypein classAbstractArchiver
-
-