things.universe
Class UniverseObjectAccessor

java.lang.Object
  extended by things.universe.UniverseObjectAccessor
All Implemented Interfaces:
Accessor

public class UniverseObjectAccessor
extends java.lang.Object
implements Accessor

This is a cheap access for a file. Only one access allowed at a time! It will lock the object.

You are at the mercy of the implementation in terms of multi-threading.

Version:
1.0

Version History

EPG - Initial - 13 JAN 05
 
Author:
Erich P. Gatejen

Constructor Summary
UniverseObjectAccessor(Universe theUniverse, java.lang.String... name)
          Constructor.
 
Method Summary
 void doneWithRead(java.io.InputStream ios)
          Declare you are done reading from the input stream.
 void doneWithWrite(java.io.OutputStream oos)
          Declare you are done reading from the input stream.
 java.io.InputStream openForRead()
          Open the item for read.
 java.io.OutputStream openForWrite()
          Open the item for writing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniverseObjectAccessor

public UniverseObjectAccessor(Universe theUniverse,
                              java.lang.String... name)
                       throws ThingsException
Constructor.

Parameters:
name - name of the universe object.
theUniverse - the universe in which it exists.
Throws:
ThingsException
Method Detail

openForRead

public java.io.InputStream openForRead()
                                throws ThingsException
Open the item for read. You can assume it is buffered.

Specified by:
openForRead in interface Accessor
Returns:
return an input stream for the item. It will never return null; problems will cause exceptions.
Throws:
ThingsException - for any problem.

doneWithRead

public void doneWithRead(java.io.InputStream ios)
                  throws ThingsException
Declare you are done reading from the input stream. It is a good idea to call this, though it shouldn't be fatal if you don't.

Specified by:
doneWithRead in interface Accessor
Parameters:
ios - the stream you were given when you openForRead(). You may close the stream already, if you want.
Throws:
ThingsException - for any problem.

openForWrite

public java.io.OutputStream openForWrite()
                                  throws ThingsException
Open the item for writing. You can assume it is buffered.

Specified by:
openForWrite in interface Accessor
Returns:
return an output stream for the item. It will never return null; problems will cause exceptions.
Throws:
ThingsException - for any problem.

doneWithWrite

public void doneWithWrite(java.io.OutputStream oos)
                   throws ThingsException
Declare you are done reading from the input stream. It is a good idea to call this, though it shouldn't be fatal if you don't.

Specified by:
doneWithWrite in interface Accessor
Parameters:
oos - the stream you were given when you openForWrite(). You may flush and close the stream already, if you want.
Throws:
ThingsException - for any problem.


Things.