org.apache.hadoop.io.compress
Class CompressionOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.hadoop.io.compress.CompressionOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Direct Known Subclasses:
CompressorStream

public abstract class CompressionOutputStream
extends java.io.OutputStream

A compression output stream.


Field Summary
protected  java.io.OutputStream out
          The output stream to be compressed.
 
Constructor Summary
protected CompressionOutputStream(java.io.OutputStream out)
          Create a compression output stream that writes the compressed bytes to the given stream.
 
Method Summary
 void close()
           
abstract  void finish()
          Finishes writing compressed data to the output stream without closing the underlying stream.
 void flush()
           
abstract  void resetState()
          Reset the compression to the initial state.
abstract  void write(byte[] b, int off, int len)
          Write compressed bytes to the stream.
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected final java.io.OutputStream out
The output stream to be compressed.

Constructor Detail

CompressionOutputStream

protected CompressionOutputStream(java.io.OutputStream out)
Create a compression output stream that writes the compressed bytes to the given stream.

Parameters:
out -
Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

write

public abstract void write(byte[] b,
                           int off,
                           int len)
                    throws java.io.IOException
Write compressed bytes to the stream. Made abstract to prevent leakage to underlying stream.

Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

finish

public abstract void finish()
                     throws java.io.IOException
Finishes writing compressed data to the output stream without closing the underlying stream.

Throws:
java.io.IOException

resetState

public abstract void resetState()
                         throws java.io.IOException
Reset the compression to the initial state. Does not reset the underlying stream.

Throws:
java.io.IOException


Copyright © 2009 The Apache Software Foundation