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

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.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

Nested Class Summary
(package private)  class RdbBlob.RdbInputStream
           
 
Field Summary
protected  java.util.ArrayList bufferList
          This arrayList contains buffers.
protected  int bufferSize
          The size of the buffer stored in the buffer list
private  byte[] currentBuffer
          The current buffer.
private  int currentPos
          The current position in the last buffer
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
private  void bprintln(java.lang.String msg1, byte b, java.lang.String msg2)
           
 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)
           
private  void println(java.lang.String msg)
           
 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.


currentBuffer

private byte[] currentBuffer
The current buffer.


currentPos

private int currentPos
The current position in the last buffer


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
Throws:
java.sql.SQLException

getBytes

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

getBinaryStream

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

position

public long position(byte[] bytes,
                     long l)
              throws java.sql.SQLException
Specified by:
position in interface java.sql.Blob
Throws:
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
Throws:
java.sql.SQLException

setBinaryStream

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

setBytes

public int setBytes(long pos,
                    byte[] bytes)
             throws java.sql.SQLException
Specified by:
setBytes in interface java.sql.Blob
Throws:
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
Throws:
java.sql.SQLException

truncate

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

close

public void close()
do nothing


flush

public void flush()
do nothing


write

public void write(byte[] b)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Throws:
java.io.IOException

println

private void println(java.lang.String msg)

bprintln

private void bprintln(java.lang.String msg1,
                      byte b,
                      java.lang.String msg2)