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 Blob
SQLException
public InputStream getBinaryStream() throws SQLException
getBinaryStream
in interface Blob
SQLException
public InputStream getBinaryStream(long pos, long length) throws SQLException
getBinaryStream
in interface Blob
SQLException
public byte[] getBytes(long pos, int length) throws SQLException
getBytes
in interface Blob
pos
- - 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 Blob
SQLException
public long position(Blob pattern, long start) throws SQLException
position
in interface Blob
pattern
- - 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 Blob
bPattern
- - 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 Blob
len
- the new length for the BLOBSQLException
public OutputStream setBinaryStream(long pos) throws SQLException
setBinaryStream
in interface Blob
pos
- - 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 Blob
pos
- 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 Blob
pos
- - 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.