Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Untar

extends Expand
Class Inheritance
Imports
java.io.BufferedInputStream, .File, .IOException, .InputStream, java.lang.reflect.Constructor, .InvocationTargetException, java.nio.file.Files, java.util.zip.GZIPInputStream, org.apache.tools.ant.BuildException, .Project, org.apache.tools.ant.types.EnumeratedAttribute, .Resource, org.apache.tools.ant.util.FileNameMapper, .FileUtils, org.apache.tools.bzip2.CBZip2InputStream, org.apache.tools.tar.TarEntry, .TarInputStream

Untar a file.

PatternSets are used to select files to extract from the archive. If no patternset is used, all files are extracted.

FileSets may be used to select archived files to perform unarchival upon.

File permissions will not be restored on extracted files.

The untar task recognizes the long pathname entries used by GNU tar.

Since
Ant 1.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Untar.UntarCompressionMethod

Valid Modes for Compression attribute to Untar Task

Field Summary

Modifier and TypeField and Description
private Untar.UntarCompressionMethod
compression

compression method

Inherited from org.apache.tools.ant.taskdefs.Expand:
ERROR_MULTIPLE_MAPPERSNATIVE_ENCODING

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
expandFile(FileUtils
the fileUtils
fileUtils
,
File
the source file
srcF
,
File
the destination directory
dir
)

Overrides org.apache.tools.ant.taskdefs.Expand.expandFile.

This method is to be overridden by extending unarchival tasks.
protected void
expandResource(Resource
the source resource
srcR
,
File
the destination directory
dir
)

Overrides org.apache.tools.ant.taskdefs.Expand.expandResource.

This method is to be overridden by extending unarchival tasks.
private void
expandStream(String name, InputStream stream, File dir)

public void
setCompression(Untar.UntarCompressionMethod
compression method
method
)

Set decompression algorithm to use; default=none.

public void
setScanForUnicodeExtraFields(boolean
boolean
b
)

Overrides org.apache.tools.ant.taskdefs.Expand.setScanForUnicodeExtraFields.

No unicode extra fields in tar.
Inherited from org.apache.tools.ant.taskdefs.Expand:
addaddaddFilesetaddPatternsetcreateMapperexecuteextractFilegetAllowFilesToEscapeDestgetEncodinggetFailOnEmptyArchivegetMappergetScanForUnicodeExtraFieldsinternalSetEncodinginternalSetScanForUnicodeExtraFieldssetAllowFilesToEscapeDestsetDestsetEncodingsetFailOnEmptyArchivesetOverwritesetSrcsetStripAbsolutePathSpec

Field Detail

compressionback to summary
private Untar.UntarCompressionMethod compression

compression method

Constructor Detail

Untarback to summary
public Untar()

Method Detail

expandFileback to summary
protected void expandFile(FileUtils fileUtils, File srcF, File dir)

Overrides org.apache.tools.ant.taskdefs.Expand.expandFile.

Doc from org.apache.tools.ant.taskdefs.Expand.expandFile.

This method is to be overridden by extending unarchival tasks.

Parameters
fileUtils:FileUtils

the fileUtils

srcF:File

the source file

dir:File

the destination directory

Annotations
@Override
See Also
Expand#expandFile(FileUtils, File, File)
expandResourceback to summary
protected void expandResource(Resource srcR, File dir)

Overrides org.apache.tools.ant.taskdefs.Expand.expandResource.

This method is to be overridden by extending unarchival tasks.

Parameters
srcR:Resource

the source resource

dir:File

the destination directory

Annotations
@Override
Since
Ant 1.7
expandStreamback to summary
private void expandStream(String name, InputStream stream, File dir) throws IOException
Since
Ant 1.7
setCompressionback to summary
public void setCompression(Untar.UntarCompressionMethod method)

Set decompression algorithm to use; default=none. Allowable values are

  • none - no compression
  • gzip - Gzip compression
  • bzip2 - Bzip2 compression
  • xz - XZ compression, requires XZ for Java
Parameters
method:Untar.UntarCompressionMethod

compression method

setScanForUnicodeExtraFieldsback to summary
public void setScanForUnicodeExtraFields(boolean b)

Overrides org.apache.tools.ant.taskdefs.Expand.setScanForUnicodeExtraFields.

No unicode extra fields in tar.

Parameters
b:boolean

Doc from org.apache.tools.ant.taskdefs.Expand.setScanForUnicodeExtraFields.

boolean

Annotations
@Override
Since
Ant 1.8.0
org.apache.tools.ant.taskdefs back to summary

public final Class Untar.UntarCompressionMethod

extends EnumeratedAttribute
Class Inheritance

Valid Modes for Compression attribute to Untar Task

Field Summary

Modifier and TypeField and Description
private static final String
BZIP2

BZIP2 compression

private static final String
GZIP

GZIP compression

private static final String
NONE

No compression

private static final String
XZ

XZ compression

Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InputStream

Returns:

input stream with on-the-fly decompression
decompress
(final String
provides location information for BuildException
name
,
final InputStream
input stream
istream
)

This method wraps the input stream with the corresponding decompression method

public String[]

Returns:

valid values
getValues
()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Get valid enumeration values
private static InputStream
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Field Detail

BZIP2back to summary
private static final String BZIP2

BZIP2 compression

GZIPback to summary
private static final String GZIP

GZIP compression

NONEback to summary
private static final String NONE

No compression

XZback to summary
private static final String XZ

XZ compression

Since
1.10.1

Constructor Detail

UntarCompressionMethodback to summary
public UntarCompressionMethod()

Constructor

Method Detail

decompressback to summary
public InputStream decompress(final String name, final InputStream istream) throws IOException, BuildException

This method wraps the input stream with the corresponding decompression method

Parameters
name:String

provides location information for BuildException

istream:InputStream

input stream

Returns:InputStream

input stream with on-the-fly decompression

Exceptions
IOException:
thrown by GZIPInputStream constructor
BuildException:
thrown if bzip stream does not start with expected magic values
getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Get valid enumeration values

Returns:String[]

valid values

Annotations
@Override
newXZInputStreamback to summary
private static InputStream newXZInputStream(InputStream istream) throws BuildException