SMILA 1.0 API documentation

org.eclipse.smila.objectstore.filesystem
Class SimpleStoreOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.eclipse.smila.objectstore.StoreOutputStream
          extended by org.eclipse.smila.objectstore.filesystem.SimpleStoreOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class SimpleStoreOutputStream
extends StoreOutputStream

Simple StoreOutputStream implementation.

Intermediate content is stored in a temporary directory but will not be visible until close() is called.


Constructor Summary
SimpleStoreOutputStream(java.io.File tempFile, java.io.File finalFile, boolean fileLocking)
          constructs a SimpleStoreOutputStream.
 
Method Summary
 void abort()
          abort the object written to.
 void close()
          
 void flush()
          
protected  boolean makeFileVisible()
          Makes file visible by copying it from the hidden store to the visible one and removing the shadow file.
 void write(byte[] b)
          
 void write(byte[] b, int off, int len)
          
 void write(int b)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleStoreOutputStream

public SimpleStoreOutputStream(java.io.File tempFile,
                               java.io.File finalFile,
                               boolean fileLocking)
                        throws java.io.FileNotFoundException
constructs a SimpleStoreOutputStream.

Throws:
java.io.FileNotFoundException
Method Detail

abort

public void abort()
abort the object written to. Must be called before OutputStream.close() to prevent the object from becoming visible in the store. After aborting the object, no further write operations are possible.

Specified by:
abort in class StoreOutputStream

write

public void write(int b)
           throws java.io.IOException

Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException

Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException

Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

makeFileVisible

protected boolean makeFileVisible()
                           throws java.io.IOException
Makes file visible by copying it from the hidden store to the visible one and removing the shadow file.

Returns:
'true' if the operation succeeded, 'false' if not and should be retried.
Throws:
java.io.IOException - operation failed

flush

public void flush()
           throws java.io.IOException

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

SMILA 1.0 API documentation