com.caucho.vfs
Class WriterStreamImpl

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

public class WriterStreamImpl
extends StreamImpl

Handles a stream which outputs to a writer.


Field Summary
 
Fields inherited from class com.caucho.vfs.StreamImpl
_nullPath, _path
 
Constructor Summary
WriterStreamImpl()
           
 
Method Summary
 boolean canWrite()
          Returns true if this is a writable stream.
 void close()
          Closes the output.
 void flush()
          Flushes the write output.
 void setWriteEncoding(java.lang.String encoding)
          Sets the write encoding.
 void setWriter(java.io.Writer writer)
          Sets the writer.
 void write(byte[] buffer, int offset, int length, boolean isEnd)
          Writes a buffer to the underlying stream.
 
Methods inherited from class com.caucho.vfs.StreamImpl
canRead, clearWrite, closeWrite, flushBuffer, flushToDisk, getAttribute, getAttributeNames, getAvailable, getFlushOnNewline, getNewline, getPath, getReadBuffer, getReadPosition, hasSkip, isClosed, isEof, read, readNonBlock, readTimeout, removeAttribute, seekEnd, seekStart, setAttribute, setPath, skip, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriterStreamImpl

public WriterStreamImpl()
Method Detail

setWriter

public void setWriter(java.io.Writer writer)
Sets the writer.


canWrite

public boolean canWrite()
Returns true if this is a writable stream.

Overrides:
canWrite in class StreamImpl

setWriteEncoding

public void setWriteEncoding(java.lang.String encoding)
Sets the write encoding.

Overrides:
setWriteEncoding in class StreamImpl

write

public void write(byte[] buffer,
                  int offset,
                  int length,
                  boolean isEnd)
           throws java.io.IOException
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.
isEnd - true when the write is flushing a close.
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flushes the write output.

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

close

public void close()
Closes the output.

Overrides:
close in class StreamImpl