2.17.2: 2011-06-17

net.sf.basedb.util.zip
Class GzipFilePacker

java.lang.Object
  extended by net.sf.basedb.util.zip.TarFilePacker
      extended by net.sf.basedb.util.zip.GzipFilePacker
All Implemented Interfaces:
FilePacker

public class GzipFilePacker
extends TarFilePacker

This class wraps the TarFilePacker in a GZIP stream, creating a tar.gz file.

Version:
2.4
Author:
martin, Nicklas
Last modified
$Date: 2008-09-11 22:08:14 +0200 (Thu, 11 Sep 2008) $

Field Summary
private  GZIPOutputStream gzip
           
 
Constructor Summary
GzipFilePacker()
          Create a new packer that compresses files with the gzip format.
 
Method Summary
 void close()
          Finish the GZIP 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 or tar.gz Don't include the first dot!
 String getMimeType()
          Gets the MIME type to give compressed files from this packer
 void setOutputStream(OutputStream out)
          Wrap the output stream in a GZIPOutputStream.
 
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
 

Field Detail

gzip

private GZIPOutputStream gzip
Constructor Detail

GzipFilePacker

public GzipFilePacker()
Create a new packer that compresses files with the gzip format.

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 interface FilePacker
Overrides:
getDescription in class TarFilePacker
Returns:
"GZipped TAR-archive (.tar.gz)"

getFileExtension

public String getFileExtension()
Description copied from interface: FilePacker
Gets the extension that files, packed with this tool, should have, for example, zip or tar.gz Don't include the first dot!

Specified by:
getFileExtension in interface FilePacker
Overrides:
getFileExtension in class TarFilePacker
Returns:
"tar.gz"

getMimeType

public String getMimeType()
Description copied from interface: FilePacker
Gets the MIME type to give compressed files from this packer

Specified by:
getMimeType in interface FilePacker
Overrides:
getMimeType in class TarFilePacker
Returns:
"application/x-gzip"

setOutputStream

public void setOutputStream(OutputStream out)
                     throws IOException
Wrap the output stream in a GZIPOutputStream.

Specified by:
setOutputStream in interface FilePacker
Overrides:
setOutputStream in class TarFilePacker
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 GZIP stream.

Specified by:
close in interface FilePacker
Overrides:
close in class TarFilePacker
Throws:
IOException - If there are any errors

2.17.2: 2011-06-17