public final class SQLServerBlob extends Object implements Blob, Serializable
| Constructor and Description |
|---|
SQLServerBlob(SQLServerConnection connection,
byte[] data)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
free()
Frees this Blob object and releases the resources that it holds.
|
InputStream |
getBinaryStream()
Return an input stream to read data from this BLOB
|
InputStream |
getBinaryStream(long pos,
long length) |
byte[] |
getBytes(long pos,
int length)
Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes.
|
long |
length()
Return the length of the BLOB
|
long |
position(Blob pattern,
long start)
Retrieves the byte position in the BLOB value designated by this Blob object
at which pattern begins.
|
long |
position(byte[] bPattern,
long start)
Retrieves the byte position at which the specified byte array pattern begins within the
BLOB value that this Blob object represents.
|
OutputStream |
setBinaryStream(long pos)
Retrieves a stream that can be used to write to the BLOB value that this Blob object represents
|
int |
setBytes(long pos,
byte[] bytes)
Writes the given array of bytes into the Blob starting at position pos,
and returns the number of bytes written.
|
int |
setBytes(long pos,
byte[] bytes,
int offset,
int len)
Writes all or part of the given byte array to the BLOB value that this Blob object represents
and returns the number of bytes written.
|
String |
toString() |
void |
truncate(long len)
Truncate a BLOB
|
@Deprecated public SQLServerBlob(SQLServerConnection connection, byte[] data)
connection - the database connection this blob is implemented ondata - the BLOB's datapublic void free()
throws SQLException
free in interface BlobSQLExceptionpublic InputStream getBinaryStream() throws SQLException
getBinaryStream in interface BlobSQLExceptionpublic InputStream getBinaryStream(long pos, long length) throws SQLException
getBinaryStream in interface BlobSQLExceptionpublic byte[] getBytes(long pos,
int length)
throws SQLException
getBytes in interface Blobpos - - the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1length - - the number of consecutive bytes to be copied; the value for length must be 0 or greaterSQLException - - if there is an error accessing the BLOB value; if pos is less than 1 or length is less than 0public long length()
throws SQLException
length in interface BlobSQLExceptionpublic long position(Blob pattern, long start) throws SQLException
position in interface Blobpattern - - the Blob object designating the BLOB value for which to searchstart - - the position in the BLOB value at which to begin searching; the first position is 1SQLException - - if there is an error accessing the BLOB value or if start is less than 1public long position(byte[] bPattern,
long start)
throws SQLException
position in interface BlobbPattern - - the byte array for which to searchstart - - the position at which to begin searching; the first position is 1SQLException - - if there is an error accessing the BLOB or if start is less than 1public void truncate(long len)
throws SQLException
truncate in interface Bloblen - the new length for the BLOBSQLExceptionpublic OutputStream setBinaryStream(long pos) throws SQLException
setBinaryStream in interface Blobpos - - the position in the BLOB value at which to start writing; the first position is 1SQLException - - if there is an error accessing the BLOB value or if pos is less than 1public int setBytes(long pos,
byte[] bytes)
throws SQLException
setBytes in interface Blobpos - the position (1 based) in the Blob object at which to start writing the data.bytes - the array of bytes to be written into the Blob.SQLException - if there is an error accessing the BLOB value.public int setBytes(long pos,
byte[] bytes,
int offset,
int len)
throws SQLException
setBytes in interface Blobpos - - the position in the BLOB object at which to start writing; the first position is 1bytes - - the array of bytes to be written to this BLOB object.offset - - the offset (0-based) into the array bytes at which to start reading the bytes to setlen - - the number of bytes to be written to the BLOB value from the array of bytes bytesSQLException - - if there is an error accessing the BLOB value or if pos is less than 1Copyright © 2016. All rights reserved.