ssdbms.manager.primitives
Interface BLOBManager

All Superinterfaces:
BLOBValue, LOBValue, PrimitiveValue, SSDValue

public interface BLOBManager
extends BLOBValue

Manages the BLOB operations.

Author:
Egar Arturo García Cárdenas
See Also:
BLOBValue

Field Summary
 
Fields inherited from interface ssdbms.ssd.SSDValue
BLOB, BYTE_SEQUENCE, CLOB, INTEGER, NON_PRIMITIVE, REAL, STRING
 
Method Summary
 long length()
          Returns the lenght in bytes of the storaged object.
 int read(long pos, byte[] bytes)
          Reads the BLOB from a given position.
 int read(long pos, byte[] bytes, int offset, int length)
          Set part of a byte array on the BLOB from a given position, if there exist previous bytes in a matching positions they will be overwrote, in other cases the will be appended.
 void setLength(long length)
          Resizes the BLOB to the given length.
 int write(long pos, byte[] bytes)
          Writes in the BLOB from a given position.
 int write(long pos, byte[] bytes, int offset, int length)
          Writes in the BLOB from a given position.
 

Method Detail

read

public int read(long pos,
                byte[] bytes)
         throws OutOfBoundsException,
                BadFunctionException,
                FatalErrorException
Reads the BLOB from a given position.

Parameters:
pos - The position of the BLOB from which it begins to read.
bytes - Where the readed content will be storaged.
Returns:
The number of readed bytes.
Throws:
OutOfBoundsException
BadFunctionException
FatalErrorException

read

public int read(long pos,
                byte[] bytes,
                int offset,
                int length)
         throws OutOfBoundsException,
                BadFunctionException,
                FatalErrorException
Set part of a byte array on the BLOB from a given position, if there exist previous bytes in a matching positions they will be overwrote, in other cases the will be appended.

Parameters:
pos - The position of the BLOB from which it begins to read.
bytes - Where the readed content will be storaged.
offset - The start offset of bytes.
length - The maximum number of bytes to read.
Returns:
The number of readed bytes.
Throws:
OutOfBoundsException
BadFunctionException
FatalErrorException

write

public int write(long pos,
                 byte[] bytes)
          throws OutOfBoundsException,
                 BadFunctionException,
                 FatalErrorException
Writes in the BLOB from a given position.

Parameters:
pos - The position of the BLOB from which it begins to write.
bytes - Where the content to write is storaged.
Throws:
OutOfBoundsException
BadFunctionException
FatalErrorException

write

public int write(long pos,
                 byte[] bytes,
                 int offset,
                 int length)
          throws OutOfBoundsException,
                 BadFunctionException,
                 FatalErrorException
Writes in the BLOB from a given position.

Parameters:
pos - The position of the BLOB from which it begins to write.
bytes - Where the content to write is storaged.
offset - The start offset of bytes.
length - The maximum number of bytes to write.
Throws:
OutOfBoundsException
BadFunctionException
FatalErrorException

setLength

public void setLength(long length)
               throws OutOfBoundsException,
                      BadFunctionException,
                      FatalErrorException
Resizes the BLOB to the given length.

Parameters:
length - The new length of the BLOB in bytes.
Throws:
OutOfBoundsException
BadFunctionException
FatalErrorException

length

public long length()
            throws BadFunctionException,
                   FatalErrorException
Returns the lenght in bytes of the storaged object.

Returns:
The lenght of the BLOB in bytes.
Throws:
BadFunctionException
FatalErrorException