triptracker.testing.compress
Class CompressedBlockOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by triptracker.testing.compress.CompressedBlockOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class CompressedBlockOutputStream
extends FilterOutputStream


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
CompressedBlockOutputStream(OutputStream os, int size)
          Constructs a CompressedBlockOutputStream that writes to the given underlying output stream 'os' and sends a compressed block once 'size' byte have been written.
CompressedBlockOutputStream(OutputStream os, int size, int level, int strategy)
          Constructs a CompressedBlockOutputStream that writes to the given underlying output stream 'os' and sends a compressed block once 'size' byte have been written.
 
Method Summary
 void close()
           
protected  void compressAndSend()
           
 void flush()
           
 void write(byte[] b, int boff, int blen)
           
 void write(int b)
           
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressedBlockOutputStream

public CompressedBlockOutputStream(OutputStream os,
                                   int size)
                            throws IOException
Constructs a CompressedBlockOutputStream that writes to the given underlying output stream 'os' and sends a compressed block once 'size' byte have been written. The default compression strategy and level are used.

Throws:
IOException

CompressedBlockOutputStream

public CompressedBlockOutputStream(OutputStream os,
                                   int size,
                                   int level,
                                   int strategy)
                            throws IOException
Constructs a CompressedBlockOutputStream that writes to the given underlying output stream 'os' and sends a compressed block once 'size' byte have been written. The compression level and strategy should be specified using the constants defined in java.util.zip.Deflator.

Throws:
IOException
Method Detail

compressAndSend

protected void compressAndSend()
                        throws IOException
Throws:
IOException

write

public void write(int b)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int boff,
                  int blen)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class FilterOutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class FilterOutputStream
Throws:
IOException


Copyright © 2006 Team Trip Tracker. All Rights Reserved.