org.basex.io
Class TableMemAccess

java.lang.Object
  extended by org.basex.io.TableAccess
      extended by org.basex.io.TableMemAccess

public final class TableMemAccess
extends TableAccess

This class allows main memory access to the database table representation.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Constructor Summary
TableMemAccess(MetaData md, String pf)
          Stores the table in long arrays.
TableMemAccess(MetaData md, String pf, int s)
          Stores the table in long arrays.
 
Method Summary
 void close()
          Closes the table access.
 void delete(int pre, int nr)
          Deletes the specified number of entries from the database.
 void flush()
          Flushes the table contents.
 void insert(int pre, byte[] entries)
          Inserts the specified entries into the database.
 int read1(int p, int o)
          Reads a byte value and returns it as an integer value.
 int read2(int p, int o)
          Reads a short value and returns it as an integer value.
 int read4(int p, int o)
          Reads an integer value.
 long read5(int p, int o)
          Reads a 5-byte value and returns it as a long value.
 void set(int pre, byte[] entries)
          Copies the specified entry into the database.
 void write1(int p, int o, int v)
          Writes a byte value to the specified position.
 void write2(int p, int o, int v)
          Writes a short value to the specified position.
 void write4(int p, int o, int v)
          Writes an integer value to the specified position.
 void write5(int p, int o, long v)
          Writes a 5-byte value to the specified position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableMemAccess

public TableMemAccess(MetaData md,
                      String pf,
                      int s)
Stores the table in long arrays.

Parameters:
md - meta data
pf - file prefix
s - array size

TableMemAccess

public TableMemAccess(MetaData md,
                      String pf)
               throws IOException
Stores the table in long arrays.

Parameters:
md - meta data
pf - filename
Throws:
IOException - IO Exception
Method Detail

flush

public void flush()
Description copied from class: TableAccess
Flushes the table contents.

Specified by:
flush in class TableAccess

close

public void close()
           throws IOException
Description copied from class: TableAccess
Closes the table access.

Specified by:
close in class TableAccess
Throws:
IOException - I/O exception

read1

public int read1(int p,
                 int o)
Description copied from class: TableAccess
Reads a byte value and returns it as an integer value.

Specified by:
read1 in class TableAccess
Parameters:
p - pre value
o - offset
Returns:
integer value

read2

public int read2(int p,
                 int o)
Description copied from class: TableAccess
Reads a short value and returns it as an integer value.

Specified by:
read2 in class TableAccess
Parameters:
p - pre value
o - offset
Returns:
integer value

read4

public int read4(int p,
                 int o)
Description copied from class: TableAccess
Reads an integer value.

Specified by:
read4 in class TableAccess
Parameters:
p - pre value
o - offset
Returns:
integer value

read5

public long read5(int p,
                  int o)
Description copied from class: TableAccess
Reads a 5-byte value and returns it as a long value.

Specified by:
read5 in class TableAccess
Parameters:
p - pre value
o - offset
Returns:
integer value

write1

public void write1(int p,
                   int o,
                   int v)
Description copied from class: TableAccess
Writes a byte value to the specified position.

Specified by:
write1 in class TableAccess
Parameters:
p - pre value
o - offset
v - value to be written

write2

public void write2(int p,
                   int o,
                   int v)
Description copied from class: TableAccess
Writes a short value to the specified position.

Specified by:
write2 in class TableAccess
Parameters:
p - pre value
o - offset
v - value to be written

write4

public void write4(int p,
                   int o,
                   int v)
Description copied from class: TableAccess
Writes an integer value to the specified position.

Specified by:
write4 in class TableAccess
Parameters:
p - pre value
o - offset
v - value to be written

write5

public void write5(int p,
                   int o,
                   long v)
Description copied from class: TableAccess
Writes a 5-byte value to the specified position.

Specified by:
write5 in class TableAccess
Parameters:
p - pre value
o - offset
v - value to be written

delete

public void delete(int pre,
                   int nr)
Description copied from class: TableAccess
Deletes the specified number of entries from the database.

Specified by:
delete in class TableAccess
Parameters:
pre - pre value of the first node to delete
nr - number of entries to be deleted

insert

public void insert(int pre,
                   byte[] entries)
Description copied from class: TableAccess
Inserts the specified entries into the database.

Specified by:
insert in class TableAccess
Parameters:
pre - pre value
entries - array of bytes containing the entries to insert

set

public void set(int pre,
                byte[] entries)
Description copied from class: TableAccess
Copies the specified entry into the database.

Specified by:
set in class TableAccess
Parameters:
pre - pre value
entries - array of bytes containing the entries to insert