public class Blob extends Lob implements ObBlob
| Constructor and Description |
|---|
Blob()
Creates an empty blob.
|
Blob(Blob other) |
Blob(boolean hasLocator,
byte[] data,
String encoding,
OceanBaseConnection conn)
Create a BLOB with Locator
|
Blob(byte[] bytes)
Creates a blob with content.
|
Blob(byte[] bytes,
ExceptionInterceptor exceptionInterceptor) |
Blob(byte[] bytes,
int offset,
int length)
Creates a blob with content.
|
| Modifier and Type | Method and Description |
|---|---|
Reader |
getCharacterStream() |
static Blob |
getEmptyBLOB() |
com.oceanbase.jdbc.ObLobLocator |
getLocator() |
long |
length()
Returns the number of bytes in the
BLOB value designated by this Blob
object. |
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[] pattern,
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 to the
BLOB value that this Blob
object represents, 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. |
void |
setLocator(com.oceanbase.jdbc.ObLobLocator locator)
Update
ObLobLocator object which Bbob contains. |
void |
trimBlobToServer(int len)
Truncate
Blob object by the DBMS_LOB.trim(?,?), truncate data from len, exception if len is big than data's length
and success when len is less than data's length. |
void |
truncate(long len)
Truncates the
BLOB value that this Blob object represents to be
len bytes in length. |
void |
updateBlobToServer(long writeAt,
byte[] bytes,
int offset,
int length)
Update
Blob object by the DBMS_LOB.write(?,?,?,?), starting with writeAt and write the bytes to
database. |
free, getBinaryStream, getBinaryStream, getBytes, isEmptyLobclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfree, getBinaryStream, getBinaryStream, getBytespublic Blob()
public Blob(Blob other)
public Blob(byte[] bytes)
bytes - the content for the blob.public Blob(byte[] bytes,
ExceptionInterceptor exceptionInterceptor)
public Blob(byte[] bytes,
int offset,
int length)
bytes - the content for the blob.offset - offsetlength - lengthpublic Blob(boolean hasLocator,
byte[] data,
String encoding,
OceanBaseConnection conn)
data - public static Blob getEmptyBLOB() throws SQLException
SQLExceptionpublic long length()
BLOB value designated by this Blob
object.public Reader getCharacterStream() throws SQLException
SQLExceptionpublic long position(byte[] pattern,
long start)
throws SQLException
pattern begins
within the BLOB value that this Blob object represents. The search
for pattern begins at position start.position in interface Blobpattern - the byte array for which to searchstart - the position at which to begin searching; the first position is 1SQLExceptionpublic long position(Blob pattern, long start) throws SQLException
BLOB value designated by this Blob
object at which pattern begins. The search begins at position start.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 1SQLExceptionpublic int setBytes(long pos,
byte[] bytes)
throws SQLException
BLOB value that this Blob
object represents, starting at position pos, and returns the number of bytes
written. The array of bytes will overwrite the existing bytes in the Blob object
starting at the position pos. If the end of the Blob value is reached
while writing the array of bytes, then the length of the Blob value will be
increased to accommodate the extra bytes.setBytes in interface BlobsetBytes in class Lobpos - the position in the BLOB object at which to start writing; the first
position is 1bytes - the array of bytes to be written to the BLOB value that this
Blob object representsSQLExceptionLob.getBytes(long, int)public int setBytes(long pos,
byte[] bytes,
int offset,
int len)
throws SQLException
byte array to the BLOB value that
this Blob object represents and returns the number of bytes written. Writing
starts at position pos in the BLOB value; len bytes from
the given byte array are written. The array of bytes will overwrite the existing bytes in the
Blob object starting at the position pos. If the end of the
Blob value is reached while writing the array of bytes, then the length of the
Blob value will be increased to accommodate the extra bytes.
Note: If the value specified for pos is greater then the length+1 of the
BLOB value then the behavior is undefined. Some JDBC drivers may throw a
SQLException while other drivers may support this operation.
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 objectoffset - the offset into the array bytes at which to start reading the bytes
to be 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 1Lob.getBytes(long, int)public OutputStream setBinaryStream(long pos) throws SQLException
BLOB value that this
Blob object represents. The stream begins at position pos. The bytes
written to the stream will overwrite the existing bytes in the Blob object
starting at the position pos. If the end of the Blob value is reached
while writing to the stream, then the length of the Blob value will be increased
to accommodate the extra bytes.
Note: If the value specified for pos is greater then the length+1 of the
BLOB value then the behavior is undefined. Some JDBC drivers may throw a
SQLException while other drivers may support this operation.
setBinaryStream in interface BlobsetBinaryStream in class Lobpos - the position in the BLOB value at which to start writing; the first
position is 1java.io.OutputStream object to which data can be writtenSQLException - if there is an error accessing the BLOB value or if pos is
less than 1Lob.getBinaryStream()public void truncate(long len)
throws SQLException
BLOB value that this Blob object represents to be
len bytes in length.truncate in interface Bloblen - the length, in bytes, to which the BLOB value that this Blob
object represents should be truncatedSQLExceptionpublic com.oceanbase.jdbc.ObLobLocator getLocator()
getLocator in interface ObBlobpublic void setLocator(com.oceanbase.jdbc.ObLobLocator locator)
ObLobLocator object which Bbob contains.setLocator in interface ObBloblocator - Source ObLobLocator object.public void updateBlobToServer(long writeAt,
byte[] bytes,
int offset,
int length)
throws SQLException
Blob object by the DBMS_LOB.write(?,?,?,?), starting with writeAt and write the bytes to
database.updateBlobToServer in interface ObBlobwriteAt - Start position to be write.bytes - byte[] data to be write.offset - first position offset will be write.length - date length to be write.SQLException - if database error occurpublic void trimBlobToServer(int len)
throws SQLException
Blob object by the DBMS_LOB.trim(?,?), truncate data from len, exception if len is big than data's length
and success when len is less than data's length.trimBlobToServer in interface ObBloblen - truncate data from lenSQLException - if database error occurCopyright © 2022 oceanbase.com. All rights reserved.