Package 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 or disk based representation of binary data.- Version:
- $Id: BlobImpl.java,v 1.31.2.3 2009-12-30 08:45:34 ickzon Exp $
- Author:
- Brian Heineman, Mike Hutchinson
-
-
Field Summary
Fields Modifier and Type Field Description private BlobBuffer
blobBuffer
The underlyingBlobBuffer
.private static byte[]
EMPTY_BLOB
0 lengthbyte[]
as initial value for emptyBlob
s.
-
Constructor Summary
Constructors Constructor Description BlobImpl(JtdsConnection connection)
Constructs a new emptyBlob
instance.BlobImpl(JtdsConnection connection, byte[] bytes)
Constructs a newBlob
instance initialized with data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
free()
java.io.InputStream
getBinaryStream()
java.io.InputStream
getBinaryStream(long pos, long length)
byte[]
getBytes(long pos, int length)
long
length()
long
position(byte[] pattern, long start)
long
position(java.sql.Blob 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)
void
truncate(long len)
-
-
-
Field Detail
-
EMPTY_BLOB
private static final byte[] EMPTY_BLOB
0 lengthbyte[]
as initial value for emptyBlob
s.
-
blobBuffer
private final BlobBuffer blobBuffer
The underlyingBlobBuffer
.
-
-
Constructor Detail
-
BlobImpl
BlobImpl(JtdsConnection connection)
Constructs a new emptyBlob
instance.- Parameters:
connection
- a reference to the parent connection object
-
BlobImpl
BlobImpl(JtdsConnection connection, byte[] bytes)
Constructs a newBlob
instance initialized with data.- Parameters:
connection
- a reference to the parent connection objectbytes
- the blob object to encapsulate
-
-
Method Detail
-
getBinaryStream
public java.io.InputStream getBinaryStream() throws java.sql.SQLException
- Specified by:
getBinaryStream
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
getBytes
public byte[] getBytes(long pos, int length) throws java.sql.SQLException
- Specified by:
getBytes
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
length
public long length() throws java.sql.SQLException
- Specified by:
length
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
position
public long position(byte[] pattern, long start) throws java.sql.SQLException
- Specified by:
position
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
position
public long position(java.sql.Blob pattern, long start) throws java.sql.SQLException
- Specified by:
position
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
setBinaryStream
public java.io.OutputStream setBinaryStream(long pos) throws java.sql.SQLException
- Specified by:
setBinaryStream
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
setBytes
public int setBytes(long pos, byte[] bytes) throws java.sql.SQLException
- Specified by:
setBytes
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
setBytes
public int setBytes(long pos, byte[] bytes, int offset, int len) throws java.sql.SQLException
- Specified by:
setBytes
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
truncate
public void truncate(long len) throws java.sql.SQLException
- Specified by:
truncate
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
free
public void free() throws java.sql.SQLException
- Specified by:
free
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
getBinaryStream
public java.io.InputStream getBinaryStream(long pos, long length) throws java.sql.SQLException
- Specified by:
getBinaryStream
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
-