org.brains2b.data.sql.lob
Class LobCache

java.lang.Object
  extended by org.brains2b.data.sql.lob.LobCache
All Implemented Interfaces:
java.sql.Blob

public class LobCache
extends java.lang.Object
implements java.sql.Blob

LobCache is local way to store data for a Blob, Clob and ConnectedStream

The data is stored in memory if the content is smaller than 4096 bytes, otherwise the data is stored in a local file.

Version:
0.90 [21-03-2008]
Author:
dennis@brains2b.nl

Constructor Summary
LobCache()
           
 
Method Summary
protected  void finalize()
           
 java.io.InputStream getBinaryStream()
           
 byte[] getBytes(long pos, int length)
           
 int hashCode()
           
 long length()
           
 long position(java.sql.Blob pattern, long start)
           
 long position(byte[] pattern, long start)
           
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LobCache

public LobCache()
Method Detail

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Specified by:
getBinaryStream 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

length

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

position

public long position(java.sql.Blob pattern,
                     long start)
              throws java.sql.SQLException
Specified by:
position in interface java.sql.Blob
Throws:
java.sql.SQLException

position

public long position(byte[] pattern,
                     long start)
              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,
                    int offset,
                    int len)
             throws java.sql.SQLException
Specified by:
setBytes 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

truncate

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

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object