com.caucho.vfs
Class DatastoreWriteStream

java.lang.Object
  extended by com.caucho.vfs.StreamImpl
      extended by com.caucho.vfs.VfsStream
          extended by com.caucho.vfs.DatastoreWriteStream
All Implemented Interfaces:
LockableStream

public class DatastoreWriteStream
extends VfsStream
implements LockableStream

Stream encapsulating FileOutputStream


Field Summary
 
Fields inherited from class com.caucho.vfs.StreamImpl
_nullPath, _path
 
Constructor Summary
DatastoreWriteStream(DatastoreOutputStream fos)
          Create a new FileWriteStream based on the java.io.* stream.
DatastoreWriteStream(DatastoreOutputStream fos, Path path)
          Create a new FileWriteStream based on the java.io.* stream.
 
Method Summary
 void close()
          Closes the underlying stream.
 boolean lock(boolean shared, boolean block)
          Lock the shared advisory lock.
 void seekStart(long pos)
          Seeks based on the start.
 boolean unlock()
          Unlock the advisory lock.
 
Methods inherited from class com.caucho.vfs.VfsStream
canRead, canWrite, flush, flushToDisk, getAvailable, getFlushOnNewline, getNewline, getReadPosition, hasSkip, init, openRead, openRead, openReadWrite, openWrite, read, setCloseChildOnClose, setFlushOnNewline, setNewline, skip, write
 
Methods inherited from class com.caucho.vfs.StreamImpl
clearWrite, closeWrite, flushBuffer, getAttribute, getAttributeNames, getPath, getReadBuffer, isClosed, isEof, readNonBlock, readTimeout, removeAttribute, seekEnd, setAttribute, setPath, setWriteEncoding, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatastoreWriteStream

public DatastoreWriteStream(DatastoreOutputStream fos)
Create a new FileWriteStream based on the java.io.* stream.

Parameters:
fos - the underlying file output stream.

DatastoreWriteStream

public DatastoreWriteStream(DatastoreOutputStream fos,
                            Path path)
Create a new FileWriteStream based on the java.io.* stream.

Parameters:
fos - the underlying file output stream.
path - the associated Path.
Method Detail

close

public void close()
           throws java.io.IOException
Closes the underlying stream.

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

lock

public boolean lock(boolean shared,
                    boolean block)
Description copied from interface: LockableStream
Lock the shared advisory lock. This method will create a shared "read" lock when the shared argument is true and an exclusive "write" lock when the shared argument is false. If the block argument is false then this call will not block if the lock can't be obtained.

Specified by:
lock in interface LockableStream

unlock

public boolean unlock()
Description copied from interface: LockableStream
Unlock the advisory lock. Return true if a lock was held, false otherwise.

Specified by:
unlock in interface LockableStream

seekStart

public void seekStart(long pos)
               throws java.io.IOException
Seeks based on the start.

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