com.caucho.db.sql
Class BlobImpl

java.lang.Object
  extended by com.caucho.db.sql.BlobImpl
All Implemented Interfaces:
java.sql.Blob

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

The JDBC blob implementation.


Method Summary
 void free()
           
 java.io.InputStream getBinaryStream()
          Returns the blob as a stream.
 java.io.InputStream getBinaryStream(long pos, long length)
           
 byte[] getBytes(long pos, int length)
          Returns a subset of the bytes.
 long length()
          Returns the length of the blob
 long position(java.sql.Blob pattern, long start)
          Returns the position in the blob where the pattern starts.
 long position(byte[] pattern, long start)
          Returns the position in the blob where the pattern starts.
 java.io.OutputStream setBinaryStream(long pos)
          Returns a stream to write to the blob.
 int setBytes(long pos, byte[] bytes)
          Sets a subset of bytes.
 int setBytes(long pos, byte[] bytes, int offset, int length)
          Sets a subset of bytes.
 java.lang.String toString()
           
 void truncate(long length)
          Truncates the blob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Returns the blob as a stream.

Specified by:
getBinaryStream in interface java.sql.Blob
Throws:
java.sql.SQLException

getBytes

public byte[] getBytes(long pos,
                       int length)
                throws java.sql.SQLException
Returns a subset of the bytes.

Specified by:
getBytes in interface java.sql.Blob
Throws:
java.sql.SQLException

length

public long length()
            throws java.sql.SQLException
Returns the length of the blob

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
Returns the position in the blob where the pattern starts.

Specified by:
position in interface java.sql.Blob
Throws:
java.sql.SQLException

position

public long position(byte[] pattern,
                     long start)
              throws java.sql.SQLException
Returns the position in the blob where the pattern starts.

Specified by:
position in interface java.sql.Blob
Throws:
java.sql.SQLException

setBinaryStream

public java.io.OutputStream setBinaryStream(long pos)
                                     throws java.sql.SQLException
Returns a stream to write to the blob.

Specified by:
setBinaryStream in interface java.sql.Blob
Throws:
java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes)
             throws java.sql.SQLException
Sets a subset of bytes.

Specified by:
setBytes in interface java.sql.Blob
Throws:
java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes,
                    int offset,
                    int length)
             throws java.sql.SQLException
Sets a subset of bytes.

Specified by:
setBytes in interface java.sql.Blob
Throws:
java.sql.SQLException

truncate

public void truncate(long length)
              throws java.sql.SQLException
Truncates the blob

Specified by:
truncate in interface java.sql.Blob
Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

free

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

getBinaryStream

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