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
public class Bzip2FilePacker extends TarFilePacker
This class wraps theTarFilePacker
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
Fields Modifier and Type Field Description private org.apache.tools.bzip2.CBZip2OutputStream
bzip
-
Constructor Summary
Constructors Constructor Description Bzip2FilePacker()
Create a new packer that compresses files with the BZIP2 format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Finish the BZIP stream.String
getDescription()
Get a short description of this file format that is suitable for display in selection list boxes.String
getFileExtension()
Gets the extension that files, packed with this tool, should have, for example,zip
ortar.gz
Don't include the first dot!String
getMimeType()
Gets the MIME type to give compressed files from this packervoid
setOutputStream(OutputStream out)
Wrap the output stream in aGZIPOutputStream
.-
Methods inherited from class net.sf.basedb.util.zip.TarFilePacker
pack
-
-
-
-
Method Detail
-
getDescription
public String 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
public String 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
public String 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
public void setOutputStream(OutputStream out) throws IOException
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
public void close() throws IOException
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
-
-