com.caucho.vfs
Class ReaderWriterStream
java.lang.Object
|
+--com.caucho.vfs.StreamImpl
|
+--com.caucho.vfs.ReaderWriterStream
- public class ReaderWriterStream
- extends StreamImpl
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. |
java.lang.String |
getEncoding()
|
boolean |
getFlushOnNewline()
Returns true if the buffer should be flushed on every newline. |
void |
init(java.io.Reader is,
java.io.Writer os)
|
int |
read(byte[] buf,
int offset,
int length)
Reads the next chunk from the stream. |
void |
setCloseChildOnClose(boolean close)
|
void |
setFlushOnNewline(boolean value)
|
void |
write(byte[] buf,
int offset,
int length,
boolean isEnd)
Implementation of the writer write. |
Methods inherited from class com.caucho.vfs.StreamImpl |
clearWrite, getAttribute, getAttributeNames, getAvailable, getNewline, getPath, getReadPosition, hasSkip, removeAttribute, setAttribute, setPath, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReaderWriterStream
public ReaderWriterStream(java.io.Reader is,
java.io.Writer os)
ReaderWriterStream
public ReaderWriterStream(java.io.Reader is,
java.io.Writer os,
Path path)
init
public void init(java.io.Reader is,
java.io.Writer os)
getEncoding
public java.lang.String getEncoding()
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[] buf,
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
- Following copied from class:
com.caucho.vfs.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.
canWrite
public boolean canWrite()
- Description copied from class:
StreamImpl
- Returns true if this is a writable stream.
- Overrides:
canWrite
in class StreamImpl
getFlushOnNewline
public boolean getFlushOnNewline()
- Description copied from class:
StreamImpl
- Returns true if the buffer should be flushed on every newline. This is
typically only true for error streams like stderr:.
- Overrides:
getFlushOnNewline
in class StreamImpl
setFlushOnNewline
public void setFlushOnNewline(boolean value)
write
public void write(byte[] buf,
int offset,
int length,
boolean isEnd)
throws java.io.IOException
- Implementation of the writer write.
- Overrides:
write
in class StreamImpl
- Parameters:
buf
- byte buffer containing the bytesoffset
- offset where to start writinglength
- number of bytes to writeisEnd
- true when the write is flushing a close.
flush
public void flush()
throws java.io.IOException
- Description copied from class:
StreamImpl
- Flushes the write output.
- Overrides:
flush
in class StreamImpl
setCloseChildOnClose
public void setCloseChildOnClose(boolean close)
close
public void close()
throws java.io.IOException
- Description copied from class:
StreamImpl
- Closes the stream.
- Overrides:
close
in class StreamImpl