Mobios v0.91

mobios.util
Interface ObjectIOManager

All Known Implementing Classes:
MckoiObjectIOManager

public interface ObjectIOManager

This is an interface for object input/output management. An implementation of this interface should be backed by a stream (file, memory, socket...). It should be able to do I/O of object on the stream.

Version:
2006.05.12
Author:
Rui Mao, Willard

Method Summary
 void close()
          Closes the backing stream.
 void flush()
          Flushes the backing stream.
 Iterator iterator()
           
 boolean open()
          Opens the backing stream.
 Object readObject(long pointer)
          Reads a previously written object at a given position.
 Object readPersistObject(long pointer)
          Reads a previously written object at a given position, and holds this object in memory for the duration of the program.
 Object removeObject(long pointer)
          Deletes an object from the underlying stream.
 long size()
           
 long writeObject(Object object)
          Writes a new object to the underlying stream.
 Object writeObject(Object object, long pointer)
          Writes an object to a given position in the underlying stream.
 

Method Detail

open

boolean open()
Opens the backing stream. Makes the manager ready for I/O operations.

Returns:
boolean true is sucessfully opened, otherwise false

flush

void flush()
           throws IOException
Flushes the backing stream. Saves all unsaved modifications.

Throws:
IOException

close

void close()
Closes the backing stream.


readObject

Object readObject(long pointer)
                  throws IOException,
                         ClassNotFoundException,
                         InstantiationException,
                         IllegalAccessException
Reads a previously written object at a given position.

Parameters:
pointer - the pointer to the object to be read from the underlying stream. The value is returned when the object is first written to the stream with writeObject(java.lang.Object, long)
Returns:
the object that has been read
Throws:
IOException
ClassNotFoundException
InstantiationException
IllegalAccessException

readPersistObject

Object readPersistObject(long pointer)
                         throws IOException,
                                ClassNotFoundException,
                                InstantiationException,
                                IllegalAccessException
Reads a previously written object at a given position, and holds this object in memory for the duration of the program.

Parameters:
pointer - the pointer to the object to be read in the underlying stream. The value is returned when the object is first written to the stream with writeObject(java.lang.Object, long)
Returns:
the object that has been read
Throws:
IOException
ClassNotFoundException
InstantiationException
IllegalAccessException

writeObject

Object writeObject(Object object,
                   long pointer)
                   throws IOException,
                          ClassNotFoundException
Writes an object to a given position in the underlying stream. This method modifies a previously written object at the given position.

Parameters:
object - the object to be written, cannot be null.
pointer - pointer to the underlying stream
Returns:
the original object that is overwritten.
Throws:
IOException
ClassNotFoundException

writeObject

long writeObject(Object object)
                 throws IOException
Writes a new object to the underlying stream.

Parameters:
object - the object to be added to the stream
Returns:
the pointer to the object in the stream.
Throws:
IOException

removeObject

Object removeObject(long pointer)
                    throws IOException,
                           ClassNotFoundException,
                           InstantiationException,
                           IllegalAccessException
Deletes an object from the underlying stream.

Parameters:
pointer - pointer to the object to be deleted in the underlying stream.
Returns:
the object be deleted
Throws:
IOException
ClassNotFoundException
InstantiationException
IllegalAccessException

size

long size()
          throws IOException
Returns:
the number of objects in the underlying stream
Throws:
IOException

iterator

Iterator iterator()
Returns:
an Iterator over all of the Areas in the store

Mobios v0.91

(C) 2002 - 2006 The MoBIoS Group