|
Oracle JDBC API Reference 12c Release 1 ("12.1.0.2.0") E17663-03 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectoracle.sql.Datum
oracle.sql.DatumWithConnection
oracle.sql.BLOB
public class BLOB
This class implements the java.sql.Blob interface in JDBC 2.0.
It provides the native implementation of the Blob methods.
Use 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| Field Summary | |
|---|---|
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. |
| Constructor Summary | |
|---|---|
protected |
BLOB()
Deprecated. |
| Method Summary | |
|---|---|
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. |
Object |
getACProxy()
Deprecated. |
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 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. |
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 |
void |
setACProxy(Object w)
Deprecated. |
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. |
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. |
| Methods inherited from class oracle.sql.DatumWithConnection |
|---|
assertNotNull, assertNotNull, getConnection, getConnectionDuringExceptionHandling, getOracleConnection |
| Methods inherited from class oracle.sql.Datum |
|---|
bigDecimalValue, booleanValue, bytesEqual, byteValue, compareBytes, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, isNull, longValue, setShareBytes, shareBytes, stringValue, stringValue, timestampValue, timestampValue, timeValue, timeValue, toClass |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface oracle.jdbc.internal.OracleDatumWithConnection |
|---|
bigDecimalValue, booleanValue, byteValue, dateValue, doubleValue, floatValue, getBytes, getConnection, getInternalConnection, getLength, getOracleConnection, getStream, intValue, longValue, setPhysicalConnectionOf, setShareBytes, shareBytes, stringValue, stringValue, timestampValue, timestampValue, timeValue, timeValue |
| Field Detail |
|---|
public 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
| Constructor Detail |
|---|
protected BLOB()
| Method Detail |
|---|
public long length()
throws SQLException
length in interface BlobSQLException
public 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 array
SQLException
public InputStream getBinaryStream()
throws SQLException
getBinaryStream in interface BlobSQLException
public 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.
SQLException
public 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.
SQLException
public 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.
SQLException
public 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.
SQLException
public 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.
SQLException
public OutputStream getBinaryOutputStream()
throws SQLException
SQLException
public int getChunkSize()
throws SQLException
SQLException
public int getBufferSize()
throws SQLException
SQLException
public static BLOB empty_lob()
throws SQLException
SQLException
public static BLOB getEmptyBLOB()
throws SQLException
SQLException
public boolean isEmptyLob()
throws SQLException
isEmptyLob in interface OracleBlobSQLException
public 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.
SQLException
public OutputStream getBinaryOutputStream(long pos)
throws SQLException
pos - is the position data to be put.
SQLException
public InputStream getBinaryStream(long pos)
throws SQLException
getBinaryStream in interface OracleBlobpos - is the position data to be read, should be greater than 0.
SQLException
public void trim(long newlen)
throws SQLException
newlen - the new length of the BLOB.
SQLException
public 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.
SQLException
public 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.
SQLException
public void freeTemporary()
throws SQLException
SQLException - if self is a permanent lob or self has
already been freed.
public boolean isTemporary()
throws SQLException
isTemporary in interface OracleBlobSQLException
public void open(LargeObjectAccessMode mode)
throws SQLException
open in interface OracleBlobSQLException
public void open(int mode)
throws SQLException
SQLException
public void close()
throws SQLException
close in interface OracleBlobSQLException
public boolean isOpen()
throws SQLException
isOpen in interface OracleBlobSQLException
public 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 represents
SQLException - if there is an error accessing the
BLOB value
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.
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 bytes
SQLException - if there is an error accessing the
BLOB value
public 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 writing
java.io.OutputStream object to which data can
be written
SQLException - 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 truncated
SQLException - if there is an error accessing the
BLOB value
public 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
DatumWithConnection
getJavaSqlConnection in interface oracle.jdbc.internal.OracleDatumWithConnectiongetJavaSqlConnection in class DatumWithConnectionSQLException - if an error occurspublic final int getPrefetchedDataSize()
public boolean canReadBasicLobDataInLocator()
throws SQLException
SQLException
public void free()
throws SQLException
free in interface BlobSQLException
public InputStream getBinaryStream(long pos,
long length)
throws SQLException
getBinaryStream in interface Blobpos - start positionlength - number of bytes in the result
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)
Datum
setBytes in interface oracle.jdbc.internal.OracleDatumWithConnectionsetBytes in class Datumlocator - byte array used to set the datum valuepublic void setACProxy(Object w)
setACProxy in interface oracle.jdbc.internal.ACProxyablepublic Object getACProxy()
getACProxy in interface oracle.jdbc.internal.ACProxyable
|
Oracle JDBC API Reference 12c Release 1 ("12.1.0.2.0") E17663-03 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||