org.tranche.streams
Class GZIPEncodingStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.tranche.streams.GZIPEncodingStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class GZIPEncodingStream
extends java.io.OutputStream

A stream to encode a stream of data in GZIP and outputting to a given output stream.

Author:
Jayson Falkner - jfalkner@umich.edu

Constructor Summary
GZIPEncodingStream(java.io.OutputStream out)
           
 
Method Summary
 void close()
          Flush and close the output stream.
 void flush()
          Flush the output stream.
 BigHash getHash()
          Get the hash of the file output to the stream.
 void write(byte[] b)
          Write bytes to the output stream.
 void write(byte[] buf, int off, int len)
          Write to the output stream.
 void write(int b)
          Write a byte to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZIPEncodingStream

public GZIPEncodingStream(java.io.OutputStream out)
                   throws java.io.IOException
Parameters:
out -
Throws:
java.io.IOException
Method Detail

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws java.io.IOException

Write to the output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
buf -
off -
len -
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException

Write bytes to the output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
b -
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException

Write a byte to the output stream.

Specified by:
write in class java.io.OutputStream
Parameters:
b -
Throws:
java.io.IOException

getHash

public BigHash getHash()

Get the hash of the file output to the stream.

Returns:

close

public void close()
           throws java.io.IOException

Flush and close the output stream.

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

Flush the output stream.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException


This code is free for use both commercially and non-commercially as stated in the project's license