org.objectweb.jorm.mapper.rdb.lib
Class RdbBlob

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--org.objectweb.jorm.mapper.rdb.lib.RdbBlob
All Implemented Interfaces:
java.sql.Blob

public class RdbBlob
extends java.io.OutputStream
implements java.sql.Blob

Author:
P. Dechamboux

Field Summary
protected  java.util.ArrayList bufferList
          This arrayList contains buffers.
protected  int bufferSize
          The size of the buffer stored in the buffer list
static int DEFAULT_BUFFER_SIZE
           
protected  int size
          The total length
 
Constructor Summary
RdbBlob(java.io.Serializable serobj)
          This constructor calculates the size of the serialized object.
RdbBlob(java.io.Serializable serobj, int buffersize)
          This constructor calculates the size of the serialized object.
 
Method Summary
 void close()
          do nothing
 void flush()
          do nothing
 java.io.InputStream getBinaryStream()
           
 byte[] getBytes(long pos, int length)
           
 long length()
           
 long position(java.sql.Blob blob, long l)
           
 long position(byte[] bytes, long l)
           
 java.io.OutputStream setBinaryStream(long pos)
           
 int setBytes(long pos, byte[] bytes)
           
 int setBytes(long pos, byte[] bytes, int offset, int len)
           
 void truncate(long len)
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

bufferSize

protected int bufferSize
The size of the buffer stored in the buffer list


bufferList

protected java.util.ArrayList bufferList
This arrayList contains buffers. A buffer is a byte[] which the size is bufferSize.


size

protected int size
The total length

Constructor Detail

RdbBlob

public RdbBlob(java.io.Serializable serobj)
        throws java.io.IOException
This constructor calculates the size of the serialized object.


RdbBlob

public RdbBlob(java.io.Serializable serobj,
               int buffersize)
        throws java.io.IOException
This constructor calculates the size of the serialized object.

Method Detail

length

public long length()
            throws java.sql.SQLException
Specified by:
length in interface java.sql.Blob
java.sql.SQLException

getBytes

public byte[] getBytes(long pos,
                       int length)
                throws java.sql.SQLException
Specified by:
getBytes in interface java.sql.Blob
java.sql.SQLException

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Specified by:
getBinaryStream in interface java.sql.Blob
java.sql.SQLException

position

public long position(byte[] bytes,
                     long l)
              throws java.sql.SQLException
Specified by:
position in interface java.sql.Blob
java.sql.SQLException

position

public long position(java.sql.Blob blob,
                     long l)
              throws java.sql.SQLException
Specified by:
position in interface java.sql.Blob
java.sql.SQLException

setBinaryStream

public java.io.OutputStream setBinaryStream(long pos)
                                     throws java.sql.SQLException
Specified by:
setBinaryStream in interface java.sql.Blob
java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes)
             throws java.sql.SQLException
Specified by:
setBytes in interface java.sql.Blob
java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes,
                    int offset,
                    int len)
             throws java.sql.SQLException
Specified by:
setBytes in interface java.sql.Blob
java.sql.SQLException

truncate

public void truncate(long len)
              throws java.sql.SQLException
Specified by:
truncate in interface java.sql.Blob
java.sql.SQLException

close

public void close()
do nothing

Overrides:
close in class java.io.OutputStream

flush

public void flush()
do nothing

Overrides:
flush in class java.io.OutputStream

write

public void write(byte[] b)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
java.io.IOException