Mobios v0.91

mobios.mckoi.store
Interface FileBufferAccessor


public interface FileBufferAccessor

An abstraction for accessing an underlying file through a buffering strategy. Implementations of this could include a simple RandomAccessFile paging system that uses Java 1.4 memory mapping facilities, or not.

Author:
Tobias Downer

Method Summary
 void flush()
          Flushes any pending contents of the buffer from memory to the file.
 int readByte(long position)
          Reads a single byte from the given position in the given RandomAccessFile that has been assigned the given id value.
 int readByteArray(long position, byte[] buf, int off, int len)
          Reads a byte array from the given position in the file.
 void sizeChange(long old_file_length, long new_file_length)
          Notifies the buffering strategy that the size of the file has changed.
 void writeByte(long position, byte b)
          Writes a single byte to the given position in the file.
 int writeByteArray(long position, byte[] buf, int off, int len)
          Writes a byte array to the given position in the file.
 

Method Detail

readByte

int readByte(long position)
             throws IOException
Reads a single byte from the given position in the given RandomAccessFile that has been assigned the given id value.

Throws:
IOException

readByteArray

int readByteArray(long position,
                  byte[] buf,
                  int off,
                  int len)
                  throws IOException
Reads a byte array from the given position in the file. Returns the actual number of bytes read. The value returned should ALWAYS be the value given in 'len'.

Throws:
IOException

writeByte

void writeByte(long position,
               byte b)
               throws IOException
Writes a single byte to the given position in the file.

Throws:
IOException

writeByteArray

int writeByteArray(long position,
                   byte[] buf,
                   int off,
                   int len)
                   throws IOException
Writes a byte array to the given position in the file. Returns the actual number of bytes written. The value returned should ALWAYS be the value given in 'len'.

Throws:
IOException

flush

void flush()
           throws IOException
Flushes any pending contents of the buffer from memory to the file.

Throws:
IOException

sizeChange

void sizeChange(long old_file_length,
                long new_file_length)
                throws IOException
Notifies the buffering strategy that the size of the file has changed.

Throws:
IOException

Mobios v0.91

(C) 2002 - 2006 The MoBIoS Group