net.sourceforge.jtds.jdbc
Class BlobImpl

java.lang.Object
  |
  +--net.sourceforge.jtds.jdbc.BlobImpl
All Implemented Interfaces:
java.sql.Blob

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

An in-memory, disk or database representation of binary data.

Version:
$Id: BlobImpl.java,v 1.28 2005/03/29 15:48:42 alin_sinpalean Exp $
Author:
Brian Heineman, Mike Hutchinson

Inner Class Summary
(package private)  class BlobImpl.BlobFileOutputStream
          Class to manage Blob file writes.
(package private)  class BlobImpl.BlobOutputStream
          Class to manage any Blob write.
 
Field Summary
private  byte[] _blob
           
private  java.io.File _blobFile
           
private  ConnectionJDBC2 _connection
           
private  JtdsInputStream _jtdsInputStream
           
private static byte[] EMPTY_BLOB
           
 
Constructor Summary
(package private) BlobImpl(java.lang.Object callerReference)
          Constructs a new Blob instance.
(package private) BlobImpl(java.lang.Object callerReference, byte[] blob)
          Constructs a new Blob instance.
(package private) BlobImpl(java.lang.Object callerReference, ResponseStream in)
          Constructs a new Blob instance.
 
Method Summary
protected  void finalize()
           
 java.io.InputStream getBinaryStream()
          Returns an InputStream for the BLOB data.
 byte[] getBytes(long pos, int length)
           
 long length()
          Returns the length of the value.
 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)
           
private  void skip(java.io.InputStream inputStream, long skip)
           
 void truncate(long len)
          Truncates the value to the length specified.
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

EMPTY_BLOB

private static final byte[] EMPTY_BLOB

_connection

private ConnectionJDBC2 _connection

_blob

private byte[] _blob

_blobFile

private java.io.File _blobFile

_jtdsInputStream

private JtdsInputStream _jtdsInputStream
Constructor Detail

BlobImpl

BlobImpl(java.lang.Object callerReference)
Constructs a new Blob instance.
Parameters:
callerReference - an object reference to the caller of this method; must be a Connection, Statement or ResultSet

BlobImpl

BlobImpl(java.lang.Object callerReference,
         byte[] blob)
Constructs a new Blob instance.
Parameters:
callerReference - an object reference to the caller of this method; must be a Connection, Statement or ResultSet
blob - the blob object to encapsulate

BlobImpl

BlobImpl(java.lang.Object callerReference,
         ResponseStream in)
   throws java.io.IOException
Constructs a new Blob instance.
Parameters:
callerReference - an object reference to the caller of this method; must be a Connection, Statement or ResultSet
in - the blob object to encapsulate
Method Detail

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Returns an InputStream for the BLOB data.
Specified by:
getBinaryStream in interface java.sql.Blob

getBytes

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

length

public long length()
            throws java.sql.SQLException
Returns the length of the value.
Specified by:
length in interface java.sql.Blob

position

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

position

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

setBinaryStream

public java.io.OutputStream setBinaryStream(long pos)
                                     throws java.sql.SQLException

setBytes

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

setBytes

public int setBytes(long pos,
                    byte[] bytes,
                    int offset,
                    int len)
             throws java.sql.SQLException

truncate

public void truncate(long len)
              throws java.sql.SQLException
Truncates the value to the length specified.
Parameters:
len - the length to truncate the value to

skip

private void skip(java.io.InputStream inputStream,
                  long skip)
           throws java.sql.SQLException

finalize

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


Generated on April 15 2005