| java.lang.Object org.apache.derby.client.am.Lob org.apache.derby.client.am.Blob
Constructor Summary | |
public | Blob(byte[] binaryString, Agent agent, int dataOffset) | public | Blob(Agent agent, java.io.InputStream binaryStream, int length) | public | Blob(Agent agent, java.io.InputStream binaryStream) Create a new Blob from a stream with unknown length.
Important: This constructor is a temporary solution for
implementing lengthless overloads in the JDBC4 API. |
Method Summary | |
protected long | binaryStringPosition(byte[] pattern, long start) | public void | free() This method frees the Blob object and releases the resources that
it holds. | public java.io.InputStream | getBinaryStream() | public InputStream | getBinaryStream(long pos, long length) | public byte[] | getBinaryString() | public byte[] | getBytes(long pos, int length) Returns as an array of bytes part or all of the BLOB
value that this Blob object designates. | public boolean | isBinaryStream() | public boolean | isBinaryString() | protected boolean | isSubString(byte[] pattern, int index) | public long | length() | public long | position(byte[] pattern, long start) | public long | position(java.sql.Blob pattern, long start) | public java.io.OutputStream | setBinaryStream(long pos) | public int | setBytes(long pos, byte[] bytes) | public int | setBytes(long pos, byte[] bytes, int offset, int len) | public int | setBytesX(long pos, byte[] bytes, int offset, int len) | public void | truncate(long len) |
binaryString_ | byte[] binaryString_(Code) | | |
dataOffset_ | int dataOffset_(Code) | | |
Blob | public Blob(byte[] binaryString, Agent agent, int dataOffset)(Code) | | |
Blob | public Blob(Agent agent, java.io.InputStream binaryStream)(Code) | | Create a new Blob from a stream with unknown length.
Important: This constructor is a temporary solution for
implementing lengthless overloads in the JDBC4 API. Before a proper
solution can be implemented, we need to enable streaming without having
to know the stream length in the DRDA protocol. See Jira DERBY-1471 and
DERBY-1417 for more details.
Shortcomings: This constructor will cause the whole stream
to be materialized to determine its length. If the stream is big
enough, the client will fail with an OutOfMemoryError. Since this is a
temporary solution, state checking is not added to all methods as it
would clutter up the class severely. After using the constructor, the
length -method must be called, which will materialize the
stream and determine the length. Do not pass a Blob object created
with this constructor to the user!
Parameters: agent - Parameters: binaryStream - the stream to get data from |
binaryStringPosition | protected long binaryStringPosition(byte[] pattern, long start)(Code) | | |
free | public void free() throws SQLException(Code) | | This method frees the 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.
throws: SQLException - if an error occurs releasingthe Blob's resources |
getBinaryStream | public InputStream getBinaryStream(long pos, long length) throws SQLException(Code) | | |
getBinaryString | public byte[] getBinaryString()(Code) | | |
getBytes | public byte[] getBytes(long pos, int length) throws SQLException(Code) | | Returns as an array of bytes part or all of the BLOB
value that this Blob object designates. The byte
array contains up to length consecutive bytes
starting at position pos .
The starting position must be between 1 and the length
of the BLOB plus 1. This allows for zero-length BLOB values, from
which only zero-length byte arrays can be returned.
If a larger length is requested than there are bytes available,
characters from the start position to the end of the BLOB are returned.
Parameters: pos - the ordinal position of the first byte in theBLOB value to be extracted; the first byte is atposition 1 Parameters: length - is the number of consecutive bytes to be copied a byte array containing up to length consecutive bytes from the BLOB value designatedby this Blob object, starting with thebyte at position startPos . exception: SQLException - if there is an error accessing theBLOB NOTE: If the starting position is the length of the BLOB plus 1,zero bytess are returned regardless of the length requested. |
isBinaryStream | public boolean isBinaryStream()(Code) | | |
isBinaryString | public boolean isBinaryString()(Code) | | |
isSubString | protected boolean isSubString(byte[] pattern, int index)(Code) | | |
length | public long length() throws SQLException(Code) | | |
position | public long position(byte[] pattern, long start) throws SQLException(Code) | | |
setBytes | public int setBytes(long pos, byte[] bytes) throws SQLException(Code) | | |
setBytes | public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException(Code) | | |
setBytesX | public int setBytesX(long pos, byte[] bytes, int offset, int len) throws SqlException(Code) | | |
truncate | public void truncate(long len) throws SQLException(Code) | | |
|
|