public class BLOB extends DatumWithConnection implements oracle.jdbc.internal.OracleBlob
Blob interface for declaration instead of using
concrete class oracle.sql.BLOB. java.sql.Blob has methods declared for
all opertions. For Oracle specific methods use the interface
OracleBlob.
Obtaining Blob from ResultSet
java.sql.Blob blob = resultSet.getBlob(...);
Creating temporary Blob from factory method, java.sql.Connection#crateBlob()
java.sql.Blob blob = connection.createBlob();
Blob,
OracleBlob,
Connection.createBlob(),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
DURATION_CALL
Deprecated.
|
static int |
DURATION_SESSION
Deprecated.
|
static int |
MAX_CHUNK_SIZE
Deprecated.
1907584: Changed MAX_CHUNK_SIZE from 32512 to 32768.
|
static int |
MODE_READONLY
Deprecated.
|
static int |
MODE_READWRITE
Deprecated.
|
static boolean |
TRACE
Deprecated.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BLOB()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReadBasicLobDataInLocator()
Deprecated.
Can the lob data be read directly from the locator?
|
void |
close()
Deprecated.
Close a previously opened BLOB.
|
static BLOB |
createTemporary(Connection conn,
boolean cache,
int _duration)
Deprecated.
Create a temporary blob.
|
static BLOB |
empty_lob()
Deprecated.
use getEmptyBLOB instead
|
void |
free()
Deprecated.
Free the resources the blob holds.
|
void |
freeTemporary()
Deprecated.
Free the contents and the locator of the temporary blob.
|
static void |
freeTemporary(BLOB temp_lob)
Deprecated.
Free the contents and the locator of the temporary blob.
|
OutputStream |
getBinaryOutputStream()
Deprecated.
This method is deprecated. Use setBinaryStream(1L).
|
OutputStream |
getBinaryOutputStream(long pos)
Deprecated.
This method is deprecated -- use setBinaryStream
|
InputStream |
getBinaryStream()
Deprecated.
Implements the Blob interface function.
|
InputStream |
getBinaryStream(long pos)
Deprecated.
Read from the BLOB as a stream at the requested position.
|
InputStream |
getBinaryStream(long pos,
long length)
Deprecated.
Return a binary stream beginning at the specified position and of
the specified length.
|
int |
getBufferSize()
Deprecated.
Oracle extension.
|
byte[] |
getBytes(long pos,
int length)
Deprecated.
Implements the Blob interface function.
|
int |
getBytes(long pos,
int length,
byte[] buf)
Deprecated.
Oracle extension.
|
int |
getChunkSize()
Deprecated.
Oracle extension.
|
static BLOB |
getEmptyBLOB()
Deprecated.
Return a empty lob.
|
Connection |
getJavaSqlConnection()
Deprecated.
Oracle extension
Return the java.sql.Connection associated with the
receiver.
|
int |
getPrefetchedDataSize()
Deprecated.
|
boolean |
isConvertibleTo(Class jClass)
Deprecated.
Oracle extension.
|
boolean |
isEmptyLob()
Deprecated.
Return true if the lob locator points to a empty blob.
|
boolean |
isOpen()
Deprecated.
Check whether the BLOB is opened.
|
boolean |
isSecureFile()
Deprecated.
Returns
true if this is a SecureFile (LOBs with the STORE
AS SECUREFILE option, which were introduced in Oracle Database 11g Release 1). |
boolean |
isTemporary()
Deprecated.
Return true if the lob locator points to a temporary blob.
|
static boolean |
isTemporary(BLOB lob)
Deprecated.
Return true if the lob locator points to a temporary blob.
|
long |
length()
Deprecated.
Implements the Blob interface function.
|
void |
open(int mode)
Deprecated.
Open a BLOB in the indicated mode.
|
void |
open(LargeObjectAccessMode mode)
Deprecated.
Public method using enum instead of int
|
long |
position(Blob pattern,
long start)
Deprecated.
Implements the Blob interface function.
|
long |
position(byte[] pattern,
long start)
Deprecated.
Implements the Blob interface function.
|
int |
putBytes(long pos,
byte[] bytes)
Deprecated.
This method is deprecated -- use setBytes
|
int |
putBytes(long pos,
byte[] bytes,
int length)
Deprecated.
This method is deprecated -- use setBytes
|
OutputStream |
setBinaryStream(long pos)
Deprecated.
JDBC 3.0
Retrieves a stream that can be used to write to the
BLOB
value that this Blob object represents. |
void |
setBytes(byte[] locator)
Deprecated.
Sets datum value using a byte array.
|
int |
setBytes(long pos,
byte[] bytes)
Deprecated.
JDBC 3.0
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)
Deprecated.
JDBC 3.0
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. |
Object |
toJdbc()
Deprecated.
Oracle extension.
|
SQLXML |
toSQLXML()
Deprecated.
Returns an object which impements java.sql.SQLXML with
content take from this Clob.
|
SQLXML |
toSQLXML(int csid)
Deprecated.
Returns an object which impements java.sql.SQLXML with
content taken from this Blob.
|
void |
trim(long newlen)
Deprecated.
This method id deprecated -- use truncate
|
void |
truncate(long len)
Deprecated.
JDBC 3.0
Truncates the
BLOB value that this Blob
object represents to be len bytes in length. |
assertNotNull, assertNotNull, getConnection, getConnectionDuringExceptionHandling, getOracleConnectionbigDecimalValue, booleanValue, bytesEqual, bytesHashCode, byteValue, compareBytes, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, isNull, longValue, setShareBytes, shareBytes, stringValue, stringValue, timestampValue, timestampValue, timeValue, timeValue, toClassclone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbigDecimalValue, booleanValue, byteValue, dateValue, doubleValue, floatValue, getBytes, getConnection, getInternalConnection, getLength, getOracleConnection, getStream, intValue, longValue, setPhysicalConnectionOf, setShareBytes, shareBytes, stringValue, stringValue, timestampValue, timestampValue, timeValue, timeValuepublic static final int MAX_CHUNK_SIZE
public static final int DURATION_SESSION
public static final int DURATION_CALL
public static final int MODE_READONLY
public static final int MODE_READWRITE
public static final boolean TRACE
public long length()
throws SQLException
length in interface BlobSQLExceptionpublic byte[] getBytes(long pos,
int length)
throws SQLException
getBytes in interface Blobpos - is the first byte of the blob to be extracted.length - is the number of consecutive bytes to be copied.pos argument is larger than the length of the data
the result is null. If the pos argument
is less than the length of the data, but the sum of pos
argument and the length is greater than the length of
the data, the result will be smaller than the length requested.
If the length is zero return and empty arraySQLExceptionpublic InputStream getBinaryStream() throws SQLException
getBinaryStream in interface BlobSQLExceptionpublic long position(byte[] pattern,
long start)
throws SQLException
position in interface Blobpattern - is the pattern to search for.start - is the position at which to begin searching.SQLExceptionpublic long position(Blob pattern, long start) throws SQLException
position in interface Blobpattern - is the pattern to search for.start - is the position at which to begin searching.SQLExceptionpublic int getBytes(long pos,
int length,
byte[] buf)
throws SQLException
getBytes in interface OracleBlobpos - is the first byte of the blob to be extracted.length - is the number of consecutive bytes to be copied.buf - is the buffer to had the extracted bytes.SQLExceptionpublic int putBytes(long pos,
byte[] bytes)
throws SQLException
pos - is the position data to be put.bytes - is the data to be written into BLOB.SQLExceptionpublic int putBytes(long pos,
byte[] bytes,
int length)
throws SQLException
pos - is the position data to be put.bytes - is the data to be written into BLOB.length - is the length of the data to be written into BLOB.SQLExceptionpublic OutputStream getBinaryOutputStream() throws SQLException
SQLExceptionpublic int getChunkSize()
throws SQLException
SQLExceptionpublic int getBufferSize()
throws SQLException
SQLExceptionpublic static BLOB empty_lob() throws SQLException
SQLExceptionpublic static BLOB getEmptyBLOB() throws SQLException
SQLExceptionpublic boolean isEmptyLob()
throws SQLException
isEmptyLob in interface OracleBlobSQLExceptionpublic boolean isSecureFile()
throws SQLException
true if this is a SecureFile (LOBs with the STORE
AS SECUREFILE option, which were introduced in Oracle Database 11g Release 1).isSecureFile in interface OracleBlobtrue if this is a SecureFile and false otherwise.SQLExceptionpublic OutputStream getBinaryOutputStream(long pos) throws SQLException
pos - is the position data to be put.SQLExceptionpublic InputStream getBinaryStream(long pos) throws SQLException
getBinaryStream in interface OracleBlobpos - is the position data to be read, should be greater than 0.SQLExceptionpublic void trim(long newlen)
throws SQLException
newlen - the new length of the BLOB.SQLExceptionpublic static BLOB createTemporary(Connection conn, boolean cache, int _duration) throws SQLException
cache - Specifies if LOB should be read into buffer cache or not._duration - The duration of the temporary LOB. The following are
valid values: DURATION_SESSION, DURATION_CALL.SQLExceptionpublic static void freeTemporary(BLOB temp_lob) throws SQLException
temp_lob - A temporary blob to be freeed.SQLException - if temp_lob is a permanent lob or temp_lob has
already been freed.public static boolean isTemporary(BLOB lob) throws SQLException
lob - the blob to test.SQLExceptionpublic void freeTemporary()
throws SQLException
freeTemporary in interface oracle.jdbc.internal.OracleLargeObjectSQLException - if self is a permanent lob or self has
already been freed.public boolean isTemporary()
throws SQLException
isTemporary in interface oracle.jdbc.internal.OracleLargeObjectisTemporary in interface OracleBlobSQLExceptionpublic void open(LargeObjectAccessMode mode) throws SQLException
open in interface OracleBlobSQLExceptionpublic void open(int mode)
throws SQLException
SQLExceptionpublic void close()
throws SQLException
close in interface OracleBlobSQLExceptionpublic boolean isOpen()
throws SQLException
isOpen in interface OracleBlobSQLExceptionpublic 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.setBytes in interface Blobpos - the position in the BLOB object at which
to start writingbytes - the array of bytes to be written to the BLOB
value that this Blob object representsSQLException - if there is an error accessing the
BLOB valuepublic 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.setBytes in interface Blobpos - the position in the BLOB object at which
to start writingbytes - 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 valuepublic OutputStream setBinaryStream(long pos) throws SQLException
BLOB
value that this Blob object represents. The stream begins
at position pos.setBinaryStream in interface Blobpos - the position in the BLOB value at which
to start writingjava.io.OutputStream object to which data can
be writtenSQLException - if there is an error accessing the
BLOB valuegetBinaryStream()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 truncatedSQLException - if there is an error accessing the
BLOB valuepublic Object toJdbc() throws SQLException
toJdbc in interface oracle.jdbc.internal.OracleDatumWithConnectiontoJdbc in class DatumSQLException - if any of the lower layer code throws an exception.public boolean isConvertibleTo(Class jClass)
isConvertibleTo in interface oracle.jdbc.internal.OracleDatumWithConnectionisConvertibleTo in class DatumjClass - specifies the Java data type to test against.public Connection getJavaSqlConnection() throws SQLException
DatumWithConnectiongetJavaSqlConnection in interface oracle.jdbc.internal.OracleDatumWithConnectiongetJavaSqlConnection in class DatumWithConnectionSQLException - if an error occurspublic final int getPrefetchedDataSize()
public boolean canReadBasicLobDataInLocator()
throws SQLException
SQLExceptionpublic void free()
throws SQLException
free in interface BlobSQLExceptionpublic InputStream getBinaryStream(long pos, long length) throws SQLException
getBinaryStream in interface Blobpos - start positionlength - number of bytes in the resultSQLException - if pos is less than 1 or if pos is greater than
the number of bytes in the Blob or if pos + length is greater than
the number of bytes in the Blob.public void setBytes(byte[] locator)
Datumpublic SQLXML toSQLXML() throws SQLException
toSQLXML in interface OracleBlobSQLExceptionpublic SQLXML toSQLXML(int csid) throws SQLException
toSQLXML in interface OracleBlobSQLException