com.caucho.vfs
Class GzipStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.caucho.vfs.GzipStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class GzipStream
extends java.io.OutputStream

Underlying stream handling HTTP requests.


Constructor Summary
GzipStream()
          Create a new Gzip stream.
GzipStream(java.io.OutputStream os)
          Create a new Gzip stream.
 
Method Summary
 boolean canWrite()
          The stream is always writable (?)
 void close()
          Close the connection.
 void closeWrite()
          Writes a buffer to the underlying stream.
 void flush()
          Flushes the underlying stream.
 void free()
           
 void init(java.io.OutputStream os)
          Initializes the stream for the next request.
 boolean isData()
          Checks if data is written to the stream.
 void reset()
          Resets the stream
 void setEnable(boolean enable)
          Sets true to enable;
 void setGzip(boolean isGzip)
          If true, use gzip.
 void write(byte[] buf, int offset, int length)
          Writes a buffer to the underlying stream.
 void write(int v)
          Writes a byte
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GzipStream

public GzipStream()
Create a new Gzip stream.


GzipStream

public GzipStream(java.io.OutputStream os)
           throws java.io.IOException
Create a new Gzip stream.

Throws:
java.io.IOException
Method Detail

setEnable

public void setEnable(boolean enable)
Sets true to enable;


setGzip

public void setGzip(boolean isGzip)
If true, use gzip. If false, use deflate


init

public void init(java.io.OutputStream os)
Initializes the stream for the next request.


reset

public void reset()
Resets the stream


isData

public boolean isData()
Checks if data is written to the stream.


canWrite

public boolean canWrite()
The stream is always writable (?)


write

public void write(int v)
           throws java.io.IOException
Writes a byte

Specified by:
write in class java.io.OutputStream
Parameters:
v - the value to write
Throws:
java.io.IOException

write

public void write(byte[] buf,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a buffer to the underlying stream.

Overrides:
write in class java.io.OutputStream
Parameters:
buffer - the byte array to write.
offset - the offset into the byte array.
length - the number of bytes to write.
Throws:
java.io.IOException

closeWrite

public void closeWrite()
                throws java.io.IOException
Writes a buffer to the underlying stream.

Parameters:
buffer - the byte array to write.
offset - the offset into the byte array.
length - the number of bytes to write.
isEnd - true when the write is flushing a close.
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flushes the underlying stream.

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

close

public void close()
           throws java.io.IOException
Close the connection.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

free

public void free()