org.atmosphere.gwt.server.deflate
Class DeflaterOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.atmosphere.gwt.server.deflate.DeflaterOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class DeflaterOutputStream
extends OutputStream

This class implements a stream which compresses data into the zlib format (RFC 1950).

The compression level can be specified, as a symbolic value identical to what the Deflater class expects. The default compression level is MEDIUM.

Version:
$Revision: 105 $
Author:
Thomas Pornin

Constructor Summary
DeflaterOutputStream(OutputStream out)
          Create the stream with the provided transport stream.
DeflaterOutputStream(OutputStream out, int level)
          Create the stream with the provided transport stream.
 
Method Summary
 void close()
          Close this stream; the transport stream is also closed.
 void flush()
          Flush this stream; the transport stream is also flushed.
 void write(byte[] buf)
           
 void write(byte[] buf, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeflaterOutputStream

public DeflaterOutputStream(OutputStream out)
                     throws IOException
Create the stream with the provided transport stream. The default compression level (MEDIUM) is used.

Parameters:
out - the transport stream
Throws:
IOException - on I/O error with the transport stream

DeflaterOutputStream

public DeflaterOutputStream(OutputStream out,
                            int level)
                     throws IOException
Create the stream with the provided transport stream. The provided compression level is used.

Parameters:
out - the transport stream
level - the compression level
Throws:
IOException - on I/O error with the transport stream
Method Detail

close

public void close()
           throws IOException
Close this stream; the transport stream is also closed.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException - on I/O error with the transport stream

flush

public void flush()
           throws IOException
Flush this stream; the transport stream is also flushed. At the DEFLATE level, a "sync flush" is performed, which ensures that output bytes written so far on the transport stream are sufficient to recover all the input bytes currently processed.

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException - on I/O error with the transport stream

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException
See Also:
OutputStream

write

public void write(byte[] buf)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException
See Also:
OutputStream

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException
See Also:
OutputStream


Copyright © 2014. All Rights Reserved.