org.openrdf.sesame.sailimpl.nativerdf.datastore
Class DataFile

java.lang.Object
  extended byorg.openrdf.sesame.sailimpl.nativerdf.datastore.DataFile

public class DataFile
extends Object

Class supplying access to a data file. A data file stores data sequentially. Each entry starts with the entry's length (4 bytes), followed by the data itself. File offsets are used to identify entries.

Version:
$Revision: 1.11.4.4 $
Author:
Arjohn Kampman

Nested Class Summary
 class DataFile.DataIterator
           
 
Constructor Summary
DataFile(File file)
           
 
Method Summary
 void clear()
           
 void close()
           
 void commitTransaction()
           
 byte[] getData(long offset, boolean dirtyReads)
          Gets the data that is stored at the specified offset.
 DataFile.DataIterator iterator()
           
 void rollbackTransaction()
           
 void startTransaction(boolean isolateTransaction)
           
 long storeData(byte[] data)
          Stores the specified data and returns the byte-offset at which it has been stored.
 void updateData(long offset, byte[] data)
          Updates (replaces) the data at the specified offset with the supplied data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFile

public DataFile(File file)
         throws IOException
Method Detail

startTransaction

public void startTransaction(boolean isolateTransaction)
                      throws IOException
Throws:
IOException

commitTransaction

public void commitTransaction()
                       throws IOException
Throws:
IOException

rollbackTransaction

public void rollbackTransaction()
                         throws IOException
Throws:
IOException

storeData

public long storeData(byte[] data)
               throws IOException
Stores the specified data and returns the byte-offset at which it has been stored.

Throws:
IOException

updateData

public void updateData(long offset,
                       byte[] data)
                throws IOException
Updates (replaces) the data at the specified offset with the supplied data.

Throws:
IOException

getData

public byte[] getData(long offset,
                      boolean dirtyReads)
               throws IOException
Gets the data that is stored at the specified offset.

Parameters:
offset - An offset in the data file.
dirtyReads - Flag indicating whether data that hasn't been committed yet should be searched too.
Returns:
The data that was found on the specified offset.
Throws:
IOException - If an I/O error occurred.

clear

public void clear()
           throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

iterator

public DataFile.DataIterator iterator()


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.