Class MyBlob

java.lang.Object
  |
  +--MyBlob

public class MyBlob
extends java.lang.Object

A class used as an SQL blob object.


Field Summary
protected  byte[] data
          the byte array that stores the actual data
static int MAXLEN
          the capacity of a single blob
protected  MyBlob next
          a pointer to another blob to form a linked list
 
Constructor Summary
MyBlob(byte[] buf, int len)
          initialize a blob
 
Method Summary
 MyBlob append(byte[] buf, int len)
          Append a byte array to the end of the existing array.
 java.io.InputStream getBinaryStream()
          get input of the blob in the form of a binary stream
 byte[] getData()
          get the actual data
 MyBlob getNext()
          get the next node in the linked list
 int length()
          get the length of data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXLEN

public static int MAXLEN
the capacity of a single blob

data

protected byte[] data
the byte array that stores the actual data

next

protected MyBlob next
a pointer to another blob to form a linked list
Constructor Detail

MyBlob

public MyBlob(byte[] buf,
              int len)
initialize a blob
Parameters:
buf - data to be stored
len - the length of data to be stored
Method Detail

append

public MyBlob append(byte[] buf,
                     int len)
Append a byte array to the end of the existing array. If a blob cannot hold the data, another blob will be used.
Parameters:
buf - the array to append.
len - the number of bytes to append.
Returns:
MyBlob the last blob in the linked list

length

public int length()
get the length of data
Returns:
data length in bytes

getData

public byte[] getData()
get the actual data
Returns:
the stored data in a byte array

getNext

public MyBlob getNext()
get the next node in the linked list
Returns:
the next blob object in the list

getBinaryStream

public java.io.InputStream getBinaryStream()
get input of the blob in the form of a binary stream
Returns:
the InputStream from the blob