com.caucho.vfs
Class MemoryPath.MemoryStream

java.lang.Object
  extended by com.caucho.vfs.StreamImpl
      extended by com.caucho.vfs.MemoryPath.MemoryStream
Enclosing class:
MemoryPath

public class MemoryPath.MemoryStream
extends StreamImpl


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

Method Detail

getAvailable

public int getAvailable()
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

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 bufOffset,
                int length)
         throws java.io.IOException
Description copied from class: StreamImpl
Reads the next chunk from the stream.

Overrides:
read in class StreamImpl
Parameters:
buf - byte array receiving the data.
bufOffset - 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

getPosition

public int getPosition()

seekStart

public void seekStart(long pos)
Description copied from class: StreamImpl
Seeks based on the start.

Overrides:
seekStart in class StreamImpl

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[] buf,
                  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

flushToDisk

public void flushToDisk()
Description copied from class: StreamImpl
Flushes the write output, forcing to disk.

Overrides:
flushToDisk in class StreamImpl

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object