com.caucho.vfs
Class StreamFilter

java.lang.Object
  extended by com.caucho.vfs.StreamImpl
      extended by com.caucho.vfs.StreamFilter

public class StreamFilter
extends StreamImpl


Field Summary
protected  StreamImpl next
           
 
Fields inherited from class com.caucho.vfs.StreamImpl
_nullPath, _path
 
Constructor Summary
StreamFilter()
           
 
Method Summary
 boolean canRead()
          Returns true if this is a read stream.
 boolean canWrite()
          Returns true if this is a writable stream.
 void close()
          Closes the stream.
 void flush()
          Flushes the write output.
 int getAvailable()
          Returns the number of bytes available without blocking.
 void init(StreamImpl next)
           
 int read(byte[] buffer, int offset, int length)
          Reads the next chunk from the stream.
 void write(byte[] buffer, int offset, int length, boolean atEnd)
          Writes a buffer to the underlying stream.
 
Methods inherited from class com.caucho.vfs.StreamImpl
clearWrite, closeWrite, flushBuffer, flushToDisk, getAttribute, getAttributeNames, getFlushOnNewline, getNewline, getPath, getReadBuffer, getReadPosition, hasSkip, isClosed, isEof, readNonBlock, readTimeout, removeAttribute, seekEnd, seekStart, setAttribute, setPath, setWriteEncoding, skip, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

protected StreamImpl next
Constructor Detail

StreamFilter

public StreamFilter()
Method Detail

init

public void init(StreamImpl next)

canRead

public boolean canRead()
Description copied from class: StreamImpl
Returns true if this is a read stream.

Overrides:
canRead in class StreamImpl

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Description copied from class: StreamImpl
Reads the next chunk from the stream.

Overrides:
read in class StreamImpl
Parameters:
buffer - byte array receiving the data.
offset - starting offset into the array.
length - number of bytes to read.
Returns:
the number of bytes read or -1 on end of file.
Throws:
java.io.IOException

getAvailable

public int getAvailable()
                 throws java.io.IOException
Description copied from class: StreamImpl
Returns the number of bytes available without blocking. Depending on the stream, this may return less than the actual bytes, but will always return a number > 0 if there is any data available.

Overrides:
getAvailable in class StreamImpl
Throws:
java.io.IOException

canWrite

public boolean canWrite()
Description copied from class: StreamImpl
Returns true if this is a writable stream.

Overrides:
canWrite in class StreamImpl

write

public void write(byte[] buffer,
                  int offset,
                  int length,
                  boolean atEnd)
           throws java.io.IOException
Description copied from class: StreamImpl
Writes a buffer to the underlying stream.

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

flush

public void flush()
           throws java.io.IOException
Description copied from class: StreamImpl
Flushes the write output.

Overrides:
flush in class StreamImpl
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Description copied from class: StreamImpl
Closes the stream.

Overrides:
close in class StreamImpl
Throws:
java.io.IOException