java.lang.AutoCloseable
public interface SqlBlob
extends java.lang.AutoCloseable
Modifier and Type | Method | Description |
---|---|---|
default void |
close() |
|
Operation<java.lang.Void> |
closeOperation() |
|
default java.util.concurrent.CompletionStage<java.lang.Long> |
getPosition() |
Get the position of this
SqlBlob . |
Operation<java.lang.Long> |
getPositionOperation() |
|
java.nio.channels.AsynchronousByteChannel |
getReadChannel() |
Return a
Channel that can be used to read bytes from the
SqlBlob beginning at the position. |
java.nio.channels.AsynchronousByteChannel |
getWriteChannel() |
Return a
Channel that can be used to write bytes
to this SqlBlob beginning at the position. |
default java.util.concurrent.CompletionStage<java.lang.Long> |
length() |
Get the length of this
SqlBlob . |
Operation<java.lang.Long> |
lengthOperation() |
|
default SqlBlob |
locate(byte[] target) |
Set the position to the beginning of the next occurrence of the target
after the position.
|
default SqlBlob |
locate(SqlBlob target) |
Set the position to the beginning of the next occurrence of the target
after the position.
|
Operation<java.lang.Long> |
locateOperation(byte[] target) |
Return an
Operation to set the position to the beginning of the
next occurrence of the target after the position. |
Operation<java.lang.Long> |
locateOperation(SqlBlob target) |
Return a
Operation to set the position to the beginning of the next
occurrence of the target after the position. |
default SqlBlob |
setPosition(long offset) |
Set the position of this
SqlBlob . |
Operation<java.lang.Long> |
setPositionOperation(long offset) |
|
default SqlBlob |
trim() |
|
Operation<java.lang.Long> |
trimOperation() |
Operation<java.lang.Void> closeOperation()
default void close()
close
in interface java.lang.AutoCloseable
Operation<java.lang.Long> getPositionOperation()
Operation
that fetches the position of this SqlBlob
.
The position is 1-based. Position 0 is immediately before the first byte in
the SqlBlob
. Position 1 is the first byte in the SqlBlob
, etc.
Position length()
is the last byte in the SqlBlob
.
Position is between 0 and length + 1.Operation
that returns the position of this SqlBlob
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.default java.util.concurrent.CompletionStage<java.lang.Long> getPosition()
SqlBlob
. The position is 1-based. Position 0
is immediately before the first byte in the SqlBlob
. Position 1 is the
first byte in the SqlBlob
, etc. Position length()
is the last
byte in the SqlBlob
.
Position is between 0 and length + 1.
ISSUE: Should position be 1-based as SQL seems to do or 0-based as Java
does?SqlBlob
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.Operation<java.lang.Long> lengthOperation()
Operation
that returns the length of this SqlBlob
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.default java.util.concurrent.CompletionStage<java.lang.Long> length()
SqlBlob
.SqlBlob
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.Operation<java.lang.Long> setPositionOperation(long offset)
Operation
that sets the position of this SqlBlob
. If
offset exceeds the length of this SqlBlob
set position to the length +
1 of this SqlBlob
, ie one past the last byte.offset
- a non-negative numberOperation
that sets the position of this SqlBlob
java.lang.IllegalArgumentException
- if offset
is less than 0java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.default SqlBlob setPosition(long offset)
SqlBlob
. If offset exceeds the length of this
SqlBlob
set position to the length + 1 of this SqlBlob
, ie one
past the last byte.offset
- the 1-based position to setSqlBlob
java.lang.IllegalArgumentException
- if offset is less than 0java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.Operation<java.lang.Long> locateOperation(SqlBlob target)
Operation
to set the position to the beginning of the next
occurrence of the target after the position. If there is no such occurrence
set the position to 0.target
- a SqlBlob
created by the same Connection
containing the byte sequence to search forOperation
that locates target
in this
SqlBlob
java.lang.IllegalArgumentException
- if target
was created by some
other Connection
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.default SqlBlob locate(SqlBlob target)
target
- the byte sequence to search forSqlBlob
java.lang.IllegalArgumentException
- if target
was created by some
other Connection
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closedOperation<java.lang.Long> locateOperation(byte[] target)
Operation
to set the position to the beginning of the
next occurrence of the target after the position. If there is no such
occurrence set the position to 0.target
- the byte sequence to search for. Not null
. Captured.Operation
that locates target
in this
SqlBlob
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.default SqlBlob locate(byte[] target)
target
- the byte sequence to search forSqlBlob
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.Operation<java.lang.Long> trimOperation()
Operation
that truncates this SqlBlob
so that the
current position is the end of the SqlBlob
. If the position is N, then
after trim()
the length is N - 1. The position is still N. This
will fail if position is 0.Operation
that trims the length of this SqlBlob
java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed or position is 0.default SqlBlob trim()
SqlBlob
so that the current position is the end of the
SqlBlob
. If the position is N, then after trim()
the length is
N - 1. The position is still N. This will fail if position is 0.java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed or position is 0.java.nio.channels.AsynchronousByteChannel getReadChannel()
Channel
that can be used to read bytes from the
SqlBlob
beginning at the position. Reading bytes from the returned
Channel
advances the position.
Each call to a read method that fetches bytes from the server creates and
submits a virtual Operation
to fetch those bytes. This virtual
Operation
is executed in sequence with other Operation
s and
may be skipped if an error occurs.Channel
beginning at the position.java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob is closed.java.nio.channels.AsynchronousByteChannel getWriteChannel()
Channel
that can be used to write bytes
to this SqlBlob
beginning at the position. Bytes written overwrite
bytes already in the SqlBlob
. Writing bytes to the returned
Channel
advances the position.
Each call to a write method that flushes bytes to the server creates and
submits a virtual Operation
to flush those bytes. This virtual
Operation
is executed in sequence with other Operation
s and
may be skipped if an error occurs.
ISSUE: Can the app read bytes from a write
Channel
? If so then maybe remove
getReadChannel()
and add a read-only flag to this method, renamed
getChannel
.Channel
beginning at the
position.java.lang.IllegalStateException
- if the Connection
that created this
SqlBlob
is closed.Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
DRAFT JDBC 4.4 EA