Package net.sf.basedb.util.zip
Class TarFilePacker
java.lang.Object
net.sf.basedb.util.zip.TarFilePacker
- All Implemented Interfaces:
AutoCloseable
,FilePacker
- Direct Known Subclasses:
Bzip2FilePacker
,GzipFilePacker
This class packs files into a TAR archive.
- Version:
- 2.4
- Author:
- martin, Nicklas
- Last modified
- $Date: 2007-07-11 15:45:01 +0200 (Mon, 02 Jul 2007) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Finish the TAR file.Get a short description of this file format that is suitable for display in selection list boxes.Gets the extension that files, packed with this tool, should have, for example,zip
ortar.gz
Don't include the first dot!Gets the MIME type to give compressed files from this packervoid
pack
(String entryName, InputStream in, long size, long lastModified) Create a newTarEntry
and write the compressed data to it.void
Wrap the output stream in aTarOutputStream
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.basedb.util.zip.FilePacker
getPasswordParameter, setPassword, supportsEncryption
-
Field Details
-
tar
private com.ice.tar.TarOutputStream tar
-
-
Constructor Details
-
TarFilePacker
public TarFilePacker()Creates a new TarFilePacker.
-
-
Method Details
-
getDescription
Description copied from interface:FilePacker
Get a short description of this file format that is suitable for display in selection list boxes.- Specified by:
getDescription
in interfaceFilePacker
- Returns:
- "TAR-archive (.tar)"
-
getFileExtension
Description copied from interface:FilePacker
Gets the extension that files, packed with this tool, should have, for example,zip
ortar.gz
Don't include the first dot!- Specified by:
getFileExtension
in interfaceFilePacker
- Returns:
- "tar"
-
getMimeType
Description copied from interface:FilePacker
Gets the MIME type to give compressed files from this packer- Specified by:
getMimeType
in interfaceFilePacker
- Returns:
- "application/x-tar"
-
setOutputStream
Wrap the output stream in aTarOutputStream
.- Specified by:
setOutputStream
in interfaceFilePacker
- Parameters:
out
- The output stream to write to- Throws:
IOException
- If there is an error setting the output stream
-
pack
Create a newTarEntry
and write the compressed data to it.- Specified by:
pack
in interfaceFilePacker
- Parameters:
entryName
- The name of the packed resource, including path informationin
- The input stream to read uncompressed data from, or null if the entry represents a directorysize
- The number of bytes of uncompressed datalastModified
- The time the contents was last modified, or 0 if not known- Throws:
IOException
- If there are any errors when reading or writing
-
close
Finish the TAR file.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceFilePacker
- Throws:
IOException
- If there are any errors
-