public class BLOB extends DatumWithConnection implements oracle.jdbc.internal.OracleBlob, oracle.jdbc.internal.OracleConcreteProxy
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_INVALID
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 int |
OLD_WRONG_DURATION_CALL
Deprecated.
|
static int |
OLD_WRONG_DURATION_SESSION
Deprecated.
|
protected oracle.jdbc.driver.OracleBlob |
target
Deprecated.
|
targetDatumWithConnectionojiOracleDatumWithConnection, targetDatum| Modifier | Constructor and Description |
|---|---|
protected |
BLOB()
Deprecated.
|
protected |
BLOB(oracle.jdbc.driver.OracleBlob b)
Deprecated.
Call from empty lob static method
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReadBasicLobDataInLocator()
Deprecated.
Can the lob data be read directly from the locator?
|
void |
closeLob()
Deprecated.
Close a previously opened BLOB.
|
static BLOB |
createTemporary(java.sql.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 |
freeLOB()
Deprecated.
|
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.
|
java.io.OutputStream |
getBinaryOutputStream()
Deprecated.
This method is deprecated. Use setBinaryStream(1L).
|
java.io.OutputStream |
getBinaryOutputStream(long pos)
Deprecated.
This method is deprecated -- use setBinaryStream
|
java.io.InputStream |
getBinaryStream()
Deprecated.
Implements the Blob interface function.
|
java.io.InputStream |
getBinaryStream(boolean isInternal)
Deprecated.
Implements the Blob interface function.
|
java.io.InputStream |
getBinaryStream(long pos)
Deprecated.
Read from the BLOB as a stream at the requested position.
|
java.io.InputStream |
getBinaryStream(long pos,
long length)
Deprecated.
Return a binary stream beginning at the specified position and ofthe 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.
|
short |
getDuration()
Deprecated.
return the duration of a temporary LOB
|
static short |
getDuration(BLOB lob)
Deprecated.
return the duration of a temporary LOB
|
static BLOB |
getEmptyBLOB()
Deprecated.
Return a empty lob.
|
java.sql.Connection |
getJavaSqlConnection()
Deprecated.
Oracle extension
Return the java.sql.Connection associated with the
receiver.
|
oracle.jdbc.internal.OracleLargeObject.PrefetchData<byte[]> |
getPrefetchData()
Deprecated.
|
int |
getPrefetchedDataSize()
Deprecated.
|
oracle.jdbc.driver.OracleBlob |
getTarget()
Deprecated.
|
boolean |
isConvertibleTo(java.lang.Class<?> jClass)
Deprecated.
Oracle extension.
|
boolean |
isEmptyLob()
Deprecated.
Return true if the lob locator points to a empty blob.
|
boolean |
isFree()
Deprecated.
|
boolean |
isOpenLob()
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.
The name of this method is anticipated to conflict with a
future version of the JDBC Specification. This method will be removed in a
future version of the Oracle JDBC Driver. Any calls to this method should
be replaced with a call to
openLob(int), which provides the
exact same behavior. |
void |
openLob(int mode)
Deprecated.
Open a BLOB in the indicated mode.
|
void |
openLob(LargeObjectAccessMode mode)
Deprecated.
Public method using enum instead of int
|
long |
position(java.sql.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
|
java.io.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. |
void |
setPrefetchData(oracle.jdbc.internal.OracleLargeObject.PrefetchData<byte[]> prefetchData)
Deprecated.
|
java.lang.Object |
toJdbc()
Deprecated.
Oracle extension.
|
java.sql.SQLXML |
toSQLXML()
Deprecated.
Returns an object which impements java.sql.SQLXML with
content take from this Clob.
|
java.sql.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, timeValueclose, isOpen, openpublic static final int MAX_CHUNK_SIZE
public static final int DURATION_INVALID
public static final int DURATION_SESSION
public static final int DURATION_CALL
public static final int OLD_WRONG_DURATION_SESSION
public static final int OLD_WRONG_DURATION_CALL
public static final int MODE_READONLY
public static final int MODE_READWRITE
protected oracle.jdbc.driver.OracleBlob target
protected BLOB()
protected BLOB(oracle.jdbc.driver.OracleBlob b)
public oracle.jdbc.driver.OracleBlob getTarget()
public long length()
throws java.sql.SQLException
length in interface java.sql.Blobjava.sql.SQLExceptionpublic byte[] getBytes(long pos,
int length)
throws java.sql.SQLException
getBytes in interface java.sql.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 arrayjava.sql.SQLExceptionpublic java.io.InputStream getBinaryStream()
throws java.sql.SQLException
getBinaryStream in interface java.sql.Blobjava.sql.SQLExceptionpublic java.io.InputStream getBinaryStream(boolean isInternal)
throws java.sql.SQLException
java.sql.SQLExceptionpublic long position(byte[] pattern,
long start)
throws java.sql.SQLException
position in interface java.sql.Blobpattern - is the pattern to search for.start - is the position at which to begin searching.java.sql.SQLExceptionpublic long position(java.sql.Blob pattern,
long start)
throws java.sql.SQLException
position in interface java.sql.Blobpattern - is the pattern to search for.start - is the position at which to begin searching.java.sql.SQLExceptionpublic int getBytes(long pos,
int length,
byte[] buf)
throws java.sql.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.java.sql.SQLExceptionpublic int putBytes(long pos,
byte[] bytes)
throws java.sql.SQLException
pos - is the position data to be put.bytes - is the data to be written into BLOB.java.sql.SQLExceptionpublic int putBytes(long pos,
byte[] bytes,
int length)
throws java.sql.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.java.sql.SQLExceptionpublic java.io.OutputStream getBinaryOutputStream()
throws java.sql.SQLException
java.sql.SQLExceptionpublic int getChunkSize()
throws java.sql.SQLException
java.sql.SQLExceptionpublic int getBufferSize()
throws java.sql.SQLException
java.sql.SQLExceptionpublic static BLOB empty_lob() throws java.sql.SQLException
java.sql.SQLExceptionpublic static BLOB getEmptyBLOB() throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean isEmptyLob()
throws java.sql.SQLException
isEmptyLob in interface OracleBlobjava.sql.SQLExceptionpublic boolean isSecureFile()
throws java.sql.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.java.sql.SQLExceptionpublic java.io.OutputStream getBinaryOutputStream(long pos)
throws java.sql.SQLException
pos - is the position data to be put.java.sql.SQLExceptionpublic java.io.InputStream getBinaryStream(long pos)
throws java.sql.SQLException
getBinaryStream in interface OracleBlobpos - is the position data to be read, should be greater than 0.java.sql.SQLExceptionpublic void trim(long newlen)
throws java.sql.SQLException
newlen - the new length of the BLOB.java.sql.SQLExceptionpublic static BLOB createTemporary(java.sql.Connection conn, boolean cache, int _duration) throws java.sql.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.java.sql.SQLExceptionpublic static void freeTemporary(BLOB temp_lob) throws java.sql.SQLException
temp_lob - A temporary blob to be freeed.java.sql.SQLException - if temp_lob is a permanent lob or temp_lob has
already been freed.public static boolean isTemporary(BLOB lob) throws java.sql.SQLException
lob - the blob to test.java.sql.SQLExceptionpublic static short getDuration(BLOB lob) throws java.sql.SQLException
java.sql.SQLExceptionpublic void freeTemporary()
throws java.sql.SQLException
freeTemporary in interface oracle.jdbc.internal.OracleLargeObject<byte[]>java.sql.SQLException - if self is a permanent lob or self has
already been freed.public boolean isTemporary()
throws java.sql.SQLException
isTemporary in interface oracle.jdbc.internal.OracleLargeObject<byte[]>isTemporary in interface OracleBlobjava.sql.SQLExceptionpublic short getDuration()
throws java.sql.SQLException
getDuration in interface oracle.jdbc.internal.OracleLargeObject<byte[]>java.sql.SQLExceptionpublic void openLob(LargeObjectAccessMode mode) throws java.sql.SQLException
openLob in interface OracleBlobjava.sql.SQLException@Deprecated
public void open(int mode)
throws java.sql.SQLException
openLob(int), which provides the
exact same behavior.java.sql.SQLExceptionpublic void openLob(int mode)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void closeLob()
throws java.sql.SQLException
closeLob in interface OracleBlobjava.sql.SQLExceptionpublic boolean isOpenLob()
throws java.sql.SQLException
isOpenLob in interface OracleBlobjava.sql.SQLExceptionpublic int setBytes(long pos,
byte[] bytes)
throws java.sql.SQLException
BLOB value that
this Blob object represents, starting at position
pos, and returns the number of bytes written.setBytes in interface java.sql.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 representsjava.sql.SQLException - if there is an error accessing the
BLOB valuepublic int setBytes(long pos,
byte[] bytes,
int offset,
int len)
throws java.sql.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 java.sql.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 bytesjava.sql.SQLException - if there is an error accessing the
BLOB valuepublic java.io.OutputStream setBinaryStream(long pos)
throws java.sql.SQLException
BLOB
value that this Blob object represents. The stream begins
at position pos.setBinaryStream in interface java.sql.Blobpos - the position in the BLOB value at which
to start writingjava.io.OutputStream object to which data can
be writtenjava.sql.SQLException - if there is an error accessing the
BLOB valuegetBinaryStream()public void truncate(long len)
throws java.sql.SQLException
BLOB value that this Blob
object represents to be len bytes in length.truncate in interface java.sql.Bloblen - the length, in bytes, to which the BLOB value
that this Blob object represents should be truncatedjava.sql.SQLException - if there is an error accessing the
BLOB valuepublic java.lang.Object toJdbc()
throws java.sql.SQLException
public boolean isConvertibleTo(java.lang.Class<?> jClass)
isConvertibleTo in interface oracle.jdbc.internal.OracleDatumWithConnectionisConvertibleTo in class DatumjClass - specifies the Java data type to test against.public java.sql.Connection getJavaSqlConnection()
throws java.sql.SQLException
DatumWithConnectiongetJavaSqlConnection in interface oracle.jdbc.internal.OracleDatumWithConnectiongetJavaSqlConnection in class DatumWithConnectionjava.sql.SQLException - if an error occurspublic final void setPrefetchData(oracle.jdbc.internal.OracleLargeObject.PrefetchData<byte[]> prefetchData)
setPrefetchData in interface oracle.jdbc.internal.OracleLargeObject<byte[]>public final oracle.jdbc.internal.OracleLargeObject.PrefetchData<byte[]> getPrefetchData()
getPrefetchData in interface oracle.jdbc.internal.OracleLargeObject<byte[]>public final int getPrefetchedDataSize()
public boolean canReadBasicLobDataInLocator()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void freeLOB()
throws java.sql.SQLException
freeLOB in interface oracle.jdbc.internal.OracleLargeObject<byte[]>java.sql.SQLExceptionpublic void free()
throws java.sql.SQLException
free in interface java.sql.Blobjava.sql.SQLExceptionpublic java.io.InputStream getBinaryStream(long pos,
long length)
throws java.sql.SQLException
getBinaryStream in interface java.sql.Blobpos - start positionlength - number of bytes in the resultjava.sql.SQLException - 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 java.sql.SQLXML toSQLXML()
throws java.sql.SQLException
toSQLXML in interface OracleBlobjava.sql.SQLExceptionpublic java.sql.SQLXML toSQLXML(int csid)
throws java.sql.SQLException
toSQLXML in interface OracleBlobjava.sql.SQLExceptionpublic final boolean isFree()
isFree in interface oracle.jdbc.internal.OracleLargeObject<byte[]>