org.ozoneDB.blob
Class BLOBContainerImpl

java.lang.Object
  extended byorg.ozoneDB.OzoneObject
      extended byorg.ozoneDB.blob.BLOBContainerImpl
All Implemented Interfaces:
BLOBContainer, org.ozoneDB.OzoneCompatible, org.ozoneDB.OzoneCompatibleOrProxy, org.ozoneDB.OzoneRemote, java.io.Serializable

public class BLOBContainerImpl
extends org.ozoneDB.OzoneObject
implements BLOBContainer

The BLOB implementation. The data are stored in several BLOBPages. The data of the BLOB can be accessed through BLOBInOutputStreams.

Version:
$Revision: 1.4 $Date: 2003/04/11 14:47:40 $
Author:
SMB
See Also:
Serialized Form

Field Summary
protected  boolean debug
           
protected static int DEFAULT_PAGE_SIZE
           
protected  org.ozoneDB.DxLib.DxVector pages
           
protected  int pageSize
           
 
Constructor Summary
BLOBContainerImpl()
           
 
Method Summary
 int available(int _index)
          Returns the available bytes of this BLOB beginning at index.
 void init(int _pageSize)
           
 void onDelete()
          This method must be called to kill all referenced BLOBpages.
protected  int pageNum(int index)
           
protected  int pageOff(int index)
           
 byte[] read(int index, int len)
           
 void write(int _index, byte[] b, int off, int len)
          Writes the content of the Array into the BLOB starting at index.
 
Methods inherited from class org.ozoneDB.OzoneObject
container, database, deleteRecursive, equals, getHandle, getObjectID, handle, hashCode, onActivate, onCreate, onPassivate, requireWriteLocking, self, setContainer, toString, toXML
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy
getObjectID
 

Field Detail

DEFAULT_PAGE_SIZE

protected static final int DEFAULT_PAGE_SIZE
See Also:
Constant Field Values

debug

protected boolean debug

pages

protected org.ozoneDB.DxLib.DxVector pages

pageSize

protected int pageSize
Constructor Detail

BLOBContainerImpl

public BLOBContainerImpl()
Method Detail

init

public void init(int _pageSize)
Specified by:
init in interface BLOBContainer

available

public int available(int _index)
              throws java.lang.Exception
Returns the available bytes of this BLOB beginning at index. NEVER WRITE ON BLOB WHILE EXECUTING THIS METHOD!

Specified by:
available in interface BLOBContainer
Parameters:
_index - the startposition
Returns:
the number of available bytes after _index
Throws:
java.lang.Exception - (some kind of databaseexception ?)

write

public void write(int _index,
                  byte[] b,
                  int off,
                  int len)
           throws java.lang.Exception
Writes the content of the Array into the BLOB starting at index.

Specified by:
write in interface BLOBContainer
Parameters:
_index - the write startposition in the BLOB
b - the bytearray to be stored
off - the startindex in the bytearray
len - the number of bytes to be written into the BLOB
Throws:
java.lang.Exception

read

public byte[] read(int index,
                   int len)
            throws java.lang.Exception
Specified by:
read in interface BLOBContainer
Throws:
java.lang.Exception

onDelete

public void onDelete()
This method must be called to kill all referenced BLOBpages. (hope the database does this for me...)

Specified by:
onDelete in interface org.ozoneDB.OzoneCompatible

pageNum

protected int pageNum(int index)

pageOff

protected int pageOff(int index)


Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.