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

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

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

Author:
P. D?chamboux

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  long 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

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 long 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

getBytes

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

getBinaryStream

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

position

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

position

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

setBinaryStream

public java.io.OutputStream setBinaryStream(long pos)
                                     throws java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes)
             throws java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes,
                    int offset,
                    int len)
             throws java.sql.SQLException

truncate

public void truncate(long len)
              throws 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)
Overrides:
write in class java.io.OutputStream

write

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

write

public void write(int b)
Overrides:
write in class java.io.OutputStream