org.jpox.store.rdbms.datatype
Class BlobImpl

java.lang.Object
  extended byorg.jpox.store.rdbms.datatype.BlobImpl
All Implemented Interfaces:
java.sql.Blob

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

The representation (mapping) in the Java TM programming language of an SQL BLOB value. An SQL BLOB is a built-in type that stores a Binary Large Object as a column value in a row of a database table. The driver implements Blob using an SQL locator(BLOB), which means that a Blob object contains a logical pointer to the SQL BLOB data rather than the data itself. A Blob object is valid for the duration of the transaction in which is was created.

Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement, such as getBlob and setBlob allow a programmer to access an SQL BLOB value. The Blob interface provides methods for getting the length of an SQL BLOB (Binary Large Object) value, for materializing a BLOB value on the client, and for determining the position of a pattern of bytes within a BLOB value.

This class is new in the JDBC 2.0 API.

Version:
$Revision: 1.4 $

Constructor Summary
BlobImpl(byte[] bytes)
          Constructor taking a byte array.
BlobImpl(java.io.InputStream stream)
          Constructor taking an InputStream.
BlobImpl(java.lang.Object obj)
          Constructor taking a serialised object.
 
Method Summary
 java.io.InputStream getBinaryStream()
           
 byte[] getBytes(long pos, int length)
           
 java.lang.Object getObject()
          Accessor for the Object.
 long length()
           
 long position(java.sql.Blob pattern, long start)
           
 long position(byte[] pattern, long start)
           
 java.io.OutputStream setBinaryStream(long value)
           
 int setBytes(long value, byte[] bytes)
           
 int setBytes(long value, byte[] bytes, int pos, int length)
           
 void truncate(long value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlobImpl

public BlobImpl(java.lang.Object obj)
         throws java.io.IOException
Constructor taking a serialised object.

Parameters:
obj - The serialised object.
Throws:
java.io.IOException

BlobImpl

public BlobImpl(byte[] bytes)
Constructor taking a byte array.

Parameters:
bytes - The byte array

BlobImpl

public BlobImpl(java.io.InputStream stream)
Constructor taking an InputStream.

Parameters:
stream - The InputStream
Method Detail

getObject

public java.lang.Object getObject()
Accessor for the Object.

Returns:
The object.

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

setBytes

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

truncate

public void truncate(long value)
Specified by:
truncate in interface java.sql.Blob

setBytes

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

setBinaryStream

public java.io.OutputStream setBinaryStream(long value)
                                     throws java.sql.SQLException
Specified by:
setBinaryStream 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


Copyright © -2007 . All Rights Reserved.