org.brains2b.data.sql.lob
Class BlobImpl

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

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

Implementation of Blob to access Blob's independently of the underlying database

This ColbImpl can both be used to create new Blobs and be a wrapper around a Clob provided by a database. The wrapper is needed because not all Database implementations have different ways on which one can interact with the Blob

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

Constructor Summary
BlobImpl()
           
BlobImpl(java.sql.Blob blob)
           
 
Method Summary
 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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlobImpl

public BlobImpl()

BlobImpl

public BlobImpl(java.sql.Blob blob)
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(byte[] pattern,
                     long start)
              throws java.sql.SQLException
Specified by:
position 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

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

hashCode

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