Package net.sf.basedb.util.zip
Class Bzip2FilePacker
java.lang.Object
net.sf.basedb.util.zip.TarFilePacker
net.sf.basedb.util.zip.Bzip2FilePacker
- All Implemented Interfaces:
AutoCloseable
,FilePacker
This class wraps the
TarFilePacker
in a BZIP2 stream, creating
a tar.bz2 file.- Version:
- 2.4
- Author:
- martin, Nicklas
- Last modified
- $Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a new packer that compresses files with the BZIP2 format. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Finish the BZIP stream.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
Wrap the output stream in aGZIPOutputStream
.Methods inherited from class net.sf.basedb.util.zip.TarFilePacker
pack
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
-
bzip
private org.apache.tools.bzip2.CBZip2OutputStream bzip
-
-
Constructor Details
-
Bzip2FilePacker
public Bzip2FilePacker()Create a new packer that compresses files with the BZIP2 format.
-
-
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
- Overrides:
getDescription
in classTarFilePacker
- Returns:
- "BZipped TAR-archive (.tar.bz2)"
-
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
- Overrides:
getFileExtension
in classTarFilePacker
- Returns:
- "tar.bz2"
-
getMimeType
Description copied from interface:FilePacker
Gets the MIME type to give compressed files from this packer- Specified by:
getMimeType
in interfaceFilePacker
- Overrides:
getMimeType
in classTarFilePacker
- Returns:
- "application/x-bzip2"
-
setOutputStream
Wrap the output stream in aGZIPOutputStream
.- Specified by:
setOutputStream
in interfaceFilePacker
- Overrides:
setOutputStream
in classTarFilePacker
- Parameters:
out
- The output stream to write to- Throws:
IOException
- If there is an error setting the output stream
-
close
Finish the BZIP stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceFilePacker
- Overrides:
close
in classTarFilePacker
- Throws:
IOException
- If there are any errors
-