net.sourceforge.jtds.jdbc

Class BlobImpl

Implemented Interfaces:
Blob

public class BlobImpl
extends java.lang.Object
implements Blob

An in-memory or disk based representation of binary data.
Version:
$Id: BlobImpl.java,v 1.31 2007/07/08 21:38:13 bheineman Exp $
Authors:
Brian Heineman
Mike Hutchinson

Field Summary

private static byte[]
EMPTY_BLOB
0 length byte[] as initial value for empty Blobs.
private BlobBuffer
blobBuffer
The underlying BlobBuffer.

Constructor Summary

BlobImpl(ConnectionJDBC2 connection)
Constructs a new empty Blob instance.
BlobImpl(ConnectionJDBC2 connection, byte[] bytes)
Constructs a new Blob instance initialized with data.

Method Summary

InputStream
getBinaryStream()
byte[]
getBytes(long pos, int length)
long
length()
long
position(Blob pattern, long start)
long
position(byte[] pattern, long start)
OutputStream
setBinaryStream(long pos)
int
setBytes(long pos, byte[] bytes)
int
setBytes(long pos, byte[] bytes, int offset, int len)
void
truncate(long len)

Field Details

EMPTY_BLOB

private static final byte[] EMPTY_BLOB
0 length byte[] as initial value for empty Blobs.

blobBuffer

private final BlobBuffer blobBuffer
The underlying BlobBuffer.

Constructor Details

BlobImpl

(package private)  BlobImpl(ConnectionJDBC2 connection)
Constructs a new empty Blob instance.
Parameters:
connection - a reference to the parent connection object

BlobImpl

(package private)  BlobImpl(ConnectionJDBC2 connection,
                            byte[] bytes)
Constructs a new Blob instance initialized with data.
Parameters:
connection - a reference to the parent connection object
bytes - the blob object to encapsulate

Method Details

getBinaryStream

public InputStream getBinaryStream()
            throws SQLException

getBytes

public byte[] getBytes(long pos,
                       int length)
            throws SQLException

length

public long length()
            throws SQLException

position

public long position(Blob pattern,
                     long start)
            throws SQLException

position

public long position(byte[] pattern,
                     long start)
            throws SQLException

setBinaryStream

public OutputStream setBinaryStream(long pos)
            throws SQLException

setBytes

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

setBytes

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

truncate

public void truncate(long len)
            throws SQLException

Generated on June 12 2008