com.caucho.db.block
Class BlockReadWrite

java.lang.Object
  extended by com.caucho.db.block.BlockReadWrite

public class BlockReadWrite
extends java.lang.Object

Filesystem access for the BlockStore.


Constructor Summary
BlockReadWrite(BlockStore store, Path path, boolean isEnableMmap)
          Creates a new store.
 
Method Summary
 long getFileSize()
          Returns the file size.
 void readBlock(long blockId, byte[] buffer, int offset, int length)
          Reads a block into the buffer.
 void remove()
           
 java.lang.String toString()
           
 void writeBlock(long blockAddress, byte[] buffer, int offset, int length, boolean isPriority)
          Saves the buffer to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlockReadWrite

public BlockReadWrite(BlockStore store,
                      Path path,
                      boolean isEnableMmap)
Creates a new store.

Parameters:
database - the owning database.
name - the store name
lock - the table lock
path - the path to the files
Method Detail

getFileSize

public long getFileSize()
Returns the file size.


remove

public void remove()
            throws java.sql.SQLException
Throws:
java.sql.SQLException

readBlock

public void readBlock(long blockId,
                      byte[] buffer,
                      int offset,
                      int length)
               throws java.io.IOException
Reads a block into the buffer.

Throws:
java.io.IOException

writeBlock

public void writeBlock(long blockAddress,
                       byte[] buffer,
                       int offset,
                       int length,
                       boolean isPriority)
                throws java.io.IOException
Saves the buffer to the database.

Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object