org.codehaus.plexus.archiver.util
Class Compressor

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.plexus.archiver.util.Compressor
All Implemented Interfaces:
org.codehaus.plexus.logging.LogEnabled
Direct Known Subclasses:
BZip2Compressor, GZipCompressor

public abstract class Compressor
extends org.codehaus.plexus.logging.AbstractLogEnabled

Version:
$Revision: 2436 $ $Date: 2005-09-01 13:20:41 -0400 (Thu, 01 Sep 2005) $

Field Summary
private  java.io.File destFile
           
private  java.io.File sourceFile
           
 
Constructor Summary
Compressor()
           
 
Method Summary
protected abstract  void compress()
          subclasses must implement this method to do their compression
protected  void compressFile(java.io.File file, java.io.OutputStream zOut)
          compress a file to an output stream
private  void compressFile(java.io.InputStream in, java.io.OutputStream zOut)
          compress a stream to an output stream
 void execute()
          validate, then hand off to the subclass
 java.io.File getDestFile()
           
 java.io.File getSourceFile()
           
 void setDestFile(java.io.File compressFile)
          the required destination file.
 void setSourceFile(java.io.File srcFile)
          the file to compress; required.
private  void validate()
          validation routine
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

destFile

private java.io.File destFile

sourceFile

private java.io.File sourceFile
Constructor Detail

Compressor

public Compressor()
Method Detail

setDestFile

public void setDestFile(java.io.File compressFile)
the required destination file.

Parameters:
compressFile -

getDestFile

public java.io.File getDestFile()

setSourceFile

public void setSourceFile(java.io.File srcFile)
the file to compress; required.

Parameters:
srcFile -

getSourceFile

public java.io.File getSourceFile()

validate

private void validate()
               throws ArchiverException
validation routine

Throws:
ArchiverException - if anything is invalid

execute

public void execute()
             throws ArchiverException
validate, then hand off to the subclass

Throws:
BuildException
ArchiverException

compressFile

private void compressFile(java.io.InputStream in,
                          java.io.OutputStream zOut)
                   throws java.io.IOException
compress a stream to an output stream

Parameters:
in -
zOut -
Throws:
java.io.IOException

compressFile

protected void compressFile(java.io.File file,
                            java.io.OutputStream zOut)
                     throws java.io.IOException
compress a file to an output stream

Parameters:
file -
zOut -
Throws:
java.io.IOException

compress

protected abstract void compress()
                          throws ArchiverException
subclasses must implement this method to do their compression

Throws:
ArchiverException