com.northgateis.reality.realsql
Class RealSQLBlob

java.lang.Object
 |
 +--com.northgateis.reality.realsql.RealSQLBlob

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

Implements the JDBC 2.0 Blob interface.


Constructor Summary
RealSQLBlob(byte[] b)
          Constructs a new RealSQLBlob from the specified byte array.
RealSQLBlob(java.io.InputStream is)
          Constructs a new RealSQLBlob from a binary stream.
 
Method Summary
 java.io.InputStreamgetBinaryStream()
           
 byte[]getBytes(long pos, int len)
          Provides a byte array of data from this Blob starting at the specified start position within this Blob and having the specified length.
 longlength()
           
 longposition(java.sql.Blob pattern, long start)
          Provides the position of the first occurrence of the specified pattern after the specified start position.
 longposition(byte[] pattern, long start)
          Provides the position of the first occurrence of the specified pattern after the specified start position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealSQLBlob

public RealSQLBlob(byte[] b)
Constructs a new RealSQLBlob from the specified byte array.
Parameters:
b - the array of bytes this Blob represents

RealSQLBlob

public RealSQLBlob(java.io.InputStream is)
 throws java.sql.SQLException
Constructs a new RealSQLBlob from a binary stream.
Parameters:
is - the stream from which this Blob will be created
Throws:
java.sql.SQLException - a database error occurred
Method Detail

getBinaryStream

public java.io.InputStream getBinaryStream()
 throws java.sql.SQLException
Specified by:
getBinaryStream in interface java.sql.Blob
Returns:
the Blob as an InputStream
Throws:
java.sql.SQLException - could not construct the input stream

getBytes

public byte[] getBytes(long pos,
 int len)
 throws java.sql.SQLException
Provides a byte array of data from this Blob starting at the specified start position within this Blob and having the specified length. Note that the first argument is a long as required by the JDBC 2.0 specification.
Specified by:
getBytes in interface java.sql.Blob
Parameters:
pos - the start position
len - the length of the desired return array
Returns:
an array of the bytes of this Blob from the specified start position up to the specified length
Throws:
java.sql.SQLException - the position argument was greater than the size of the Blob.

length

public long length()
 throws java.sql.SQLException
Specified by:
length in interface java.sql.Blob
Returns:
the number of bytes in this Blob
Throws:
java.sql.SQLException -  

position

public long position(java.sql.Blob pattern,
 long start)
 throws java.sql.SQLException
Provides the position of the first occurrence of the specified pattern after the specified start position.
Specified by:
position in interface java.sql.Blob
Parameters:
pattern - a Blob representing the desired pattern
start - the index from which to start the search measured from 1
Returns:
the index of the first occurrence of the specified pattern or -1 if the pattern does not occur
Throws:
java.sql.SQLException -  

position

public long position(byte[] pattern,
 long start)
 throws java.sql.SQLException
Provides the position of the first occurrence of the specified pattern after the specified start position.
Specified by:
position in interface java.sql.Blob
Parameters:
pattern - a byte array representing the desired pattern
start - the index from which to start the search measured from 1
Returns:
the index of the first occurrence of the specified pattern or -1 if the pattern does not occur
Throws:
java.sql.SQLException -