public class Blob extends Lob implements Blob
charData, data, DBMS_LOB_MAX_AMOUNT, encoding, exceptionInterceptor, isOracleMode, length, lengthFromServer, locator, offset| 构造器和说明 |
|---|
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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Reader |
getCharacterStream() |
static Blob |
getEmptyBLOB() |
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. |
protected void |
readFromServer()
Read Clob object by the DBMS_LOB.READ(lob_loc, amount, offset, buffer).
|
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 |
trimBlobToServer(int len)
Truncate
Blob object by the DBMS_LOB.trim(? |
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(? |
buildObLobLocatorV1, buildObLobLocatorV2, clearData, copy, free, getBinaryStream, getBinaryStream, getBytes, getLocator, isEmptyLob, setBinaryStreamclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfree, getBinaryStream, getBinaryStream, getBytes, setBinaryStreampublic 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)
throws SQLException
data - SQLExceptionpublic 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 在接口中 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 在接口中 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 在接口中 BlobsetBytes 在类中 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 在接口中 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 void truncate(long len)
throws SQLException
BLOB value that this Blob object represents to be
len bytes in length.truncate 在接口中 Bloblen - the length, in bytes, to which the BLOB value that this Blob
object represents should be truncatedSQLExceptionpublic 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.
DBMS_LOB.WRITE (
lob_loc IN OUT NOCOPY BLOB,
amount IN INTEGER,
offset IN INTEGER,
buffer IN RAW);
lob_loc: Locator for the internal LOB to be written to. For more information
amount: Number of bytes (for BLOBs) or characters (for CLOBs) to write
offset: Offset in bytes (for BLOBs) or characters (for CLOBs) from the start of the LOB (origin: 1) for the write operation.
buffer: Input buffer for the writewriteAt - 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.len - truncate data from lenSQLException - if database error occurprotected void readFromServer()
throws SQLException
readFromServer 在类中 LobSQLException - if database READ procedure exceptions occur
INVALID_ARGVAL: amount is less than 1, or amount is larger than 32767 bytes (or the character equivalent)
offset is less than 1, or offset is larger than LOBMAXSIZE
amount is greater, in bytes or characters, than the capacity of buffer.
NO_DATA_FOUND: End of the LOB is reached, and there are no more bytes or characters to read from the LOB: amount has a value of 0.Copyright © 2024 oceanbase.com. All rights reserved.