storage.primitiveStorage
Class PrimitiveStorageManager.Chunk

java.lang.Object
  extended bystorage.primitiveStorage.PrimitiveStorageManager.Chunk
Direct Known Subclasses:
PrimitiveStorageManager.FixedChunk, PrimitiveStorageManager.FlexibleChunk
Enclosing class:
PrimitiveStorageManager

public abstract class PrimitiveStorageManager.Chunk
extends java.lang.Object

A chunks is a part of secundary storage. Operative systems organize the secundary storage using files, so, a chunk simply is a file or a part of a file. The primitive storage component can use several chunks to organize its information. Chunks can help to overcome some storage difficulties like the size file limits provide for some operative systems, also chunks provides the use of several store devices for keeping a commun information. In database systems chunks are used to storage huge databases.


Method Summary
 java.io.RandomAccessFile getFile()
          Returns the java RandomAccessFile used by the chunk.
 java.lang.String getFileName()
          Returns the file name used by the chunk.
abstract  java.lang.String getInfo()
          Returns a string contains the chunk information.
 long getMaxSize()
          Returns the maximum size (in bytes) of the chunk.
 void readPage(long pageNumber, byte[] b)
          Reads a page from the chunk and copies the content in the specified byte array.
 void writePage(long pageNumber, byte[] b)
          Writes a page in the chunk and taking the content from a specified byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readPage

public void readPage(long pageNumber,
                     byte[] b)
              throws PageNumberOutOfRangeException,
                     java.io.IOException
Reads a page from the chunk and copies the content in the specified byte array.

Parameters:
pageNumber - The number of the page to be readed.
b - The byte array when the page's content will be copied.
Throws:
PageNumberOutOfRangeException
java.io.IOException

writePage

public void writePage(long pageNumber,
                      byte[] b)
               throws PageNumberOutOfRangeException,
                      java.io.IOException
Writes a page in the chunk and taking the content from a specified byte array.

Parameters:
pageNumber - The number of the page to be wrote.
b - The byte array from which the page takes its content.
Throws:
PageNumberOutOfRangeException
java.io.IOException

getMaxSize

public long getMaxSize()
Returns the maximum size (in bytes) of the chunk.


getFileName

public java.lang.String getFileName()
Returns the file name used by the chunk.


getFile

public java.io.RandomAccessFile getFile()
Returns the java RandomAccessFile used by the chunk.


getInfo

public abstract java.lang.String getInfo()
                                  throws java.io.IOException
Returns a string contains the chunk information.

Throws:
java.io.IOException