com.mckoi.database.global
Interface Ref

All Known Subinterfaces:
BlobRef, ClobRef

public interface Ref

An interface that represents a reference to a object that isn't stored in main memory. The reference to the object is made through the id value returned by the 'getID' method.

Author:
Tobias Downer

Method Summary
 void complete()
          This method is called when the write phrase has completed, and it marks this large object as complete.
 long getID()
          An id used to reference this object in the context of the database.
 long getRawSize()
          The 'raw' size of this large object in bytes when it is in its byte[] form.
 byte getType()
          The type of large object that is being referenced.
 void read(long offset, byte[] buf, int length)
          Reads a part of this large object from the store into the given byte buffer.
 void write(long offset, byte[] buf, int length)
          This method is used to write the contents of the large object into the backing store.
 

Method Detail

getID

long getID()
An id used to reference this object in the context of the database. Note that once a static reference is made (or removed) to/from this object, the BlobStore should be notified of the reference. The store will remove an large object that has no references to it.


getType

byte getType()
The type of large object that is being referenced. 2 = binary object, 3 = ASCII character object, 4 = Unicode character object.


getRawSize

long getRawSize()
The 'raw' size of this large object in bytes when it is in its byte[] form. This value allows us to know how many bytes we can read from this large object when it's being transferred to the client.


read

void read(long offset,
          byte[] buf,
          int length)
          throws java.io.IOException
Reads a part of this large object from the store into the given byte buffer. This method should only be used when reading a large object to transfer to the JDBC driver. It represents the byte[] representation of the object only and is only useful for transferral of the large object.

Throws:
java.io.IOException

write

void write(long offset,
           byte[] buf,
           int length)
           throws java.io.IOException
This method is used to write the contents of the large object into the backing store. This method will only work when the large object is in an initial 'write' phase in which the client is pushing the contents of the large object onto the server to be stored.

Throws:
java.io.IOException

complete

void complete()
              throws java.io.IOException
This method is called when the write phrase has completed, and it marks this large object as complete. After this method is called the large object reference is a static object that can not be changed.

Throws:
java.io.IOException