org.codehaus.plexus.archiver.tar

Class TarArchiver

Implemented Interfaces:
Archiver

public class TarArchiver
extends AbstractArchiver

Version:
$Revision: 2436 $ $Date: 2005-09-01 13:20:41 -0400 (Thu, 01 Sep 2005) $
Author:
Emmanuel Venisse

Nested Class Summary

static class
TarArchiver.TarCompressionMethod
Valid Modes for Compression attribute to Tar Task
class
TarArchiver.TarOptions
Valid Modes for Compression attribute to Tar Task

Field Summary

private TarCompressionMethod
compression
private TarLongFileMode
longFileMode
private boolean
longWarningGiven
Indicates whether the user has been warned about long files already.
private TarArchiver.TarOptions
options

Fields inherited from class org.codehaus.plexus.archiver.AbstractArchiver

DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, defaultDirectoryMode, defaultFileMode, destFile, dirsMap, filesMap, includeEmptyDirs, logger

Fields inherited from interface org.codehaus.plexus.archiver.Archiver

ROLE

Method Summary

private static boolean
containsFile(File file, Collection list)
void
createArchive()
TarArchiver.TarOptions
getOptions()
void
setCompression(TarCompressionMethod mode)
Set compression method.
void
setDefaultDirectoryMode(int mode)
Override AbstractArchiver.setDefaultDirectoryMode to update TarOptions.
void
setDefaultFileMode(int mode)
Override AbstractArchiver.setDefaultFileMode to update TarOptions.
void
setLongfile(TarLongFileMode mode)
Set how to handle long files, those with a path>100 chars.
void
setOptions(TarArchiver.TarOptions options)
Set all tar options
protected void
tarFile(ArchiveEntry entry, TarOutputStream tOut, String vPath)
tar a file

Methods inherited from class org.codehaus.plexus.archiver.AbstractArchiver

addDirectory, addDirectory, addDirectory, addDirectory, addFile, addFile, getDefaultDirectoryMode, getDefaultFileMode, getDestFile, getDirs, getFiles, getIncludeEmptyDirs, getLogger, setDefaultDirectoryMode, setDefaultFileMode, setDestFile, setIncludeEmptyDirs

Field Details

compression

private TarCompressionMethod compression

longFileMode

private TarLongFileMode longFileMode

longWarningGiven

private boolean longWarningGiven
Indicates whether the user has been warned about long files already.

options

private TarArchiver.TarOptions options

Method Details

containsFile

private static boolean containsFile(File file,
                                    Collection list)

createArchive

public void createArchive()
            throws ArchiverException,
                   IOException
Specified by:
createArchive in interface Archiver

getOptions

public TarArchiver.TarOptions getOptions()

setCompression

public void setCompression(TarCompressionMethod mode)
Set compression method. Allowable values are
  • none - no compression
  • gzip - Gzip compression
  • bzip2 - Bzip2 compression
Parameters:
mode - the compression method.

setDefaultDirectoryMode

public void setDefaultDirectoryMode(int mode)
Override AbstractArchiver.setDefaultDirectoryMode to update TarOptions.
Specified by:
setDefaultDirectoryMode in interface Archiver
Overrides:
setDefaultDirectoryMode in interface AbstractArchiver

setDefaultFileMode

public void setDefaultFileMode(int mode)
Override AbstractArchiver.setDefaultFileMode to update TarOptions.
Specified by:
setDefaultFileMode in interface Archiver
Overrides:
setDefaultFileMode in interface AbstractArchiver

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.
  • omit - paths greater than the maximum are omitted from the archive
Parameters:
mode - the mode to handle long file names.

setOptions

public void setOptions(TarArchiver.TarOptions options)
Set all tar options
Parameters:
options - options

tarFile

protected void tarFile(ArchiveEntry entry,
                       TarOutputStream tOut,
                       String vPath)
            throws ArchiverException,
                   IOException
tar a file
Parameters:
entry - the file to tar
tOut - the output stream
vPath - the path name of the file to tar