|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.as400.access.AS400JDBCBlobLocator
public class AS400JDBCBlobLocator
The AS400JDBCBlobLocator class provides access to binary large objects. The data is valid only within the current transaction.
Method Summary | |
---|---|
void |
free()
This method frees the Blob object and releases the
resources that it holds. |
InputStream |
getBinaryStream()
Returns the entire BLOB as a stream of uninterpreted bytes. |
InputStream |
getBinaryStream(long pos,
long length)
Returns an InputStream object that contains a partial
Blob value, starting with the byte specified by pos, which
is length bytes in length. |
byte[] |
getBytes(long position,
int length)
Returns part of the contents of the BLOB. |
int |
getHandle()
Returns the handle to this BLOB locator in the database. |
long |
length()
Returns the length of the BLOB. |
long |
position(Blob pattern,
long position)
Returns the position at which a pattern is found in the BLOB. |
long |
position(byte[] pattern,
long position)
Returns the position at which a pattern is found in the BLOB. |
OutputStream |
setBinaryStream(long position)
Returns a stream that an application can use to write to this BLOB. |
int |
setBytes(long position,
byte[] bytesToWrite)
Writes an array of bytes to this BLOB, starting at position position in the BLOB. |
int |
setBytes(long position,
byte[] bytesToWrite,
int offset,
int lengthOfWrite)
Writes all or part of the byte array the application passes in to this BLOB, starting at position position in the BLOB. |
void |
truncate(long lengthOfBLOB)
Truncates this BLOB to a length of lengthOfBLOB bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public InputStream getBinaryStream() throws SQLException
SQLException
- If an error occurs.public byte[] getBytes(long position, int length) throws SQLException
position
- The position within the BLOB (1-based).length
- The length to return.
SQLException
- If the position is not valid,
if the length is not valid,
or an error occurs.public int getHandle() throws SQLException
SQLException
public long length() throws SQLException
SQLException
- If an error occurs.public long position(byte[] pattern, long position) throws SQLException
pattern
- The pattern.position
- The position within the BLOB to begin
searching (1-based).
SQLException
- If the position is not valid or an error occurs.public long position(Blob pattern, long position) throws SQLException
pattern
- The pattern.position
- The position within the BLOB to begin
searching (1-based).
SQLException
- If the position is not valid or an error occurs.public OutputStream setBinaryStream(long position) throws SQLException
position
- The position (1-based) in the BLOB where writes should start.
SQLException
- If there is an error accessing the BLOB or if the position
specified is greater than the length of the BLOB.public int setBytes(long position, byte[] bytesToWrite) throws SQLException
position
- The position (1-based) in the BLOB where writes should start.bytesToWrite
- The array of bytes to be written to this BLOB.
SQLException
- If there is an error accessing the BLOB or if the position
specified is greater than the length of the BLOB.public int setBytes(long position, byte[] bytesToWrite, int offset, int lengthOfWrite) throws SQLException
position
- The position (1-based) in the BLOB where writes should start.bytesToWrite
- The array of bytes to be written to this BLOB.offset
- The offset into the array at which to start reading bytes (0-based).lengthOfWrite
- The number of bytes to be written to the BLOB from the array of bytes.
SQLException
- If there is an error accessing the BLOB or if the position
specified is greater than the length of the BLOB.public void truncate(long lengthOfBLOB) throws SQLException
lengthOfBLOB
- The length, in bytes, that this BLOB should be after
truncation.
SQLException
- If there is an error accessing the BLOB or if the length
specified is greater than the length of the BLOB.public void free() throws SQLException
Blob
object and releases the
resources that it holds. The object is invalid once the free
method is called. If free
is called multiple times, the
subsequent calls to free
are treated as a no-op.
SQLException
- if an error occurs releasing the Blob's resourcespublic InputStream getBinaryStream(long pos, long length) throws SQLException
InputStream
object that contains a partial
Blob
value, starting with the byte specified by pos, which
is length bytes in length.
pos
- the offset to the first byte of the partial value to be
retrieved. The first byte in the Blob
is at
position 1length
- the length in bytes of the partial value to be retrieved
InputStream
through which the partial
Blob
value can be read.
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |