org.egothor.util.io
Class Array

java.lang.Object
  extended by org.egothor.util.io.Array
Direct Known Subclasses:
GlobalPositionsArray

public class Array
extends java.lang.Object

This class is not synchronized!

Author:
Leo Galambos

Field Summary
 long size
           
 
Constructor Summary
Array(java.lang.String location, int itemsize, byte initValue)
           
 
Method Summary
 void close()
           
 void destroy()
           
protected  void finalize()
          Close this structure and attempt garbage collection.
 DataInputOutputStream getRf()
           
 void readSeek(long item)
          Seeks at the position of the item, the item must exist in this array else an exception is thrown.
 void writeSeek(long item)
          Seeks at the item position in a file and increases the number of items by 1 (if an expansion happened), because it assumes that we will write some data beyond the end of file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

public long size
Constructor Detail

Array

public Array(java.lang.String location,
             int itemsize,
             byte initValue)
Parameters:
location - the location where the file will be created
itemsize - the size of one array element in bytes
initValue - the byte value used as an initializator of empty bytes in the array
Method Detail

writeSeek

public void writeSeek(long item)
               throws java.io.IOException
Seeks at the item position in a file and increases the number of items by 1 (if an expansion happened), because it assumes that we will write some data beyond the end of file.

Throws:
java.io.IOException

readSeek

public void readSeek(long item)
              throws java.io.IOException
Seeks at the position of the item, the item must exist in this array else an exception is thrown.

Throws:
java.io.IOException

destroy

public void destroy()

close

public void close()

finalize

protected void finalize()
                 throws java.lang.Throwable
Close this structure and attempt garbage collection.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - you never know what might happen!

getRf

public final DataInputOutputStream getRf()