com.caucho.vfs
Class TempStream

java.lang.Object
  |
  +--com.caucho.vfs.StreamImpl
        |
        +--com.caucho.vfs.TempStream

public class TempStream
extends StreamImpl


Fields inherited from class com.caucho.vfs.StreamImpl
nullPath, path
 
Constructor Summary
TempStream(Path backingDir)
           
 
Method Summary
 boolean canWrite()
          Returns true if this is a writable stream.
 void changeToBackingFile(int index)
           
 void clearWrite()
          Clears any buffered values in the write.
 void close()
          Closes the stream.
 void destroy()
          Clean up the temp stream.
 void discard()
           
 void flush()
          Flushes the write output.
 int getLength()
          Returns the total length of the buffer's bytes
 ReadStream openRead()
          Opens a read stream to the buffer.
 ReadStream openRead(boolean free)
          Opens a read stream to the buffer.
 ReadStream openRead(ReadStream s)
           
 void openRead(ReadStream rs, boolean free)
          Opens a read stream to the buffer.
 void openWrite()
           
 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
canRead, getAttribute, getAttributeNames, getAvailable, getFlushOnNewline, getNewline, getPath, getReadPosition, hasSkip, read, removeAttribute, setAttribute, setPath, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TempStream

public TempStream(Path backingDir)
Method Detail

openWrite

public void openWrite()

changeToBackingFile

public void changeToBackingFile(int index)
                         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[] buf,
                  int offset,
                  int length,
                  boolean isEnd)
           throws java.io.IOException
Description copied from class: StreamImpl
Writes a buffer to the underlying stream.
Overrides:
write in class StreamImpl
Following copied from class: com.caucho.vfs.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.

flush

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

close

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

openRead

public ReadStream openRead()
                    throws java.io.IOException
Opens a read stream to the buffer.

openRead

public ReadStream openRead(boolean free)
                    throws java.io.IOException
Opens a read stream to the buffer.
Parameters:
free - if true, frees the buffer as it's read

openRead

public void openRead(ReadStream rs,
                     boolean free)
              throws java.io.IOException
Opens a read stream to the buffer.
Parameters:
free - if true, frees the buffer as it's read

getLength

public int getLength()
Returns the total length of the buffer's bytes

openRead

public ReadStream openRead(ReadStream s)
                    throws java.io.IOException

clearWrite

public void clearWrite()
Description copied from class: StreamImpl
Clears any buffered values in the write.
Overrides:
clearWrite in class StreamImpl

discard

public void discard()

destroy

public void destroy()
Clean up the temp stream.