Untarpublic class Untar extends Expand Untar a file.
For JDK 1.1 "last modified time" field is set to current time instead of being
carried from the archive file.
PatternSets are used to select files to extract
from the archive. If no patternset is used, all files are extracted.
FileSet>s 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. |
Fields Summary |
---|
private UntarCompressionMethod | compressioncompression method |
Methods Summary |
---|
protected void | expandFile(org.apache.tools.ant.util.FileUtils fileUtils, java.io.File srcF, java.io.File dir){@inheritDoc}
FileInputStream fis = null;
try {
fis = new FileInputStream(srcF);
expandStream(srcF.getPath(), fis, dir);
} catch (IOException ioe) {
throw new BuildException("Error while expanding " + srcF.getPath(),
ioe, getLocation());
} finally {
FileUtils.close(fis);
}
| protected void | expandResource(org.apache.tools.ant.types.Resource srcR, java.io.File dir)This method is to be overridden by extending unarchival tasks.
InputStream i = null;
try {
i = srcR.getInputStream();
expandStream(srcR.getName(), i, dir);
} catch (IOException ioe) {
throw new BuildException("Error while expanding " + srcR.getName(),
ioe, getLocation());
} finally {
FileUtils.close(i);
}
| private void | expandStream(java.lang.String name, java.io.InputStream stream, java.io.File dir)
TarInputStream tis = null;
try {
tis =
new TarInputStream(compression.decompress(name,
new BufferedInputStream(stream)));
log("Expanding: " + name + " into " + dir, Project.MSG_INFO);
TarEntry te = null;
FileNameMapper mapper = getMapper();
while ((te = tis.getNextEntry()) != null) {
extractFile(FileUtils.getFileUtils(), null, dir, tis,
te.getName(), te.getModTime(),
te.isDirectory(), mapper);
}
log("expand complete", Project.MSG_VERBOSE);
} finally {
FileUtils.close(tis);
}
| public void | setCompression(org.apache.tools.ant.taskdefs.Untar$UntarCompressionMethod method)Set decompression algorithm to use; default=none.
Allowable values are
- none - no compression
- gzip - Gzip compression
- bzip2 - Bzip2 compression
compression = method;
| public void | setEncoding(java.lang.String encoding)No encoding support in Untar.
throw new BuildException("The " + getTaskName()
+ " task doesn't support the encoding"
+ " attribute", getLocation());
|
|