net.sf.spif.optional
Class IndexedFileStore

java.lang.Object
  |
  +--net.sf.spif.StoreChain
        |
        +--net.sf.spif.optional.IndexedFileStore

public class IndexedFileStore
extends StoreChain

A file storage using Jisp.

Version:
$Id: IndexedFileStore.java,v 1.2 2003/04/03 21:00:41 bratseth Exp $
Author:
Jon S Bratseth

Field Summary
 
Fields inherited from class net.sf.spif.StoreChain
chained
 
Constructor Summary
IndexedFileStore(java.lang.String fileName)
          Creates a store with a file name to save data into
IndexedFileStore(java.lang.String fileName, int expectedSize)
          Creates a store with a file name to save data into
IndexedFileStore(java.lang.String fileName, int expectedSize, int buckets)
          Creates a store with a file name to save data into
 
Method Summary
 java.lang.Object get(Id id, boolean writeable)
          Read an object from file
 Id put(Id id, java.lang.Object object)
          Writes an object to file
 boolean remove(Id id)
          Removes an object.
 
Methods inherited from class net.sf.spif.StoreChain
clear, equals, getChained, getChained, getChained, hashCode, setChained
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedFileStore

public IndexedFileStore(java.lang.String fileName)
                 throws java.io.IOException
Creates a store with a file name to save data into


IndexedFileStore

public IndexedFileStore(java.lang.String fileName,
                        int expectedSize)
                 throws java.io.IOException
Creates a store with a file name to save data into


IndexedFileStore

public IndexedFileStore(java.lang.String fileName,
                        int expectedSize,
                        int buckets)
                 throws java.io.IOException
Creates a store with a file name to save data into

Method Detail

get

public java.lang.Object get(Id id,
                            boolean writeable)
Read an object from file

Overrides:
get in class StoreChain
Parameters:
id - the id of the object to return
Returns:
the object, or null if the object could not be retrieved or if the input id was null

put

public Id put(Id id,
              java.lang.Object object)
Writes an object to file

Overrides:
put in class StoreChain
Parameters:
id - the id of the object to put. May be null
object - the object to put. May be null
Returns:
the id of this object. This will usually be (and is in this default implementation) the input id, unless the given id is null and there is an id generating service on the store chain

remove

public boolean remove(Id id)
Description copied from class: StoreChain

Removes an object. Does nothign if the object does not exist.

This default implementation just forwards to the chained. for (optional) use by subclasses.

Overrides:
remove in class StoreChain
Parameters:
id - the id of the object to remove
Returns:
true if the object did not exists


Spif 1.01 (2003-04-03). http://spif.sf.net