BLOB value.
The SerialBlob class provides a constructor for creating
an instance from a Blob object. Note that the
Blob
object should have brought the SQL BLOB value's data over
to the client before a SerialBlob object
is constructed from it. The data of an SQL BLOB value can
be materialized on the client as an array of bytes (using the method
Blob.getBytes) or as a stream of uninterpreted bytes
(using the method Blob.getBinaryStream).
SerialBlob methods make it possible to make a copy of a
SerialBlob object as an array of bytes or as a stream.
They also make it possible to locate a given pattern of bytes or a
Blob object within a SerialBlob object
and to update or truncate a Blob object.
A SerialBlob is not safe for use by multiple concurrent threads. If a SerialBlob is to be used by more than one thread then access to the SerialBlob should be controlled by appropriate synchronization.
| Modifier and Type | Field and Description |
|---|---|
| private Blob | |
| private byte[] | buf
A serialized array of uninterpreted bytes representing the
value of this |
| private long | len
The number of bytes in this |
| private long | origLen
The original number of bytes in this |
| pack-priv static final long | serialVersionUID
The identifier that assists in the serialization of this
|
| Access | Constructor and Description |
|---|---|
| public | SerialBlob(byte[]
the b)byte array containing the data for the
Blob object to be serializedConstructs a |
| public | SerialBlob(Blob
the blob)Blob object from which this
SerialBlob object is to be constructed;
cannot be null.Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: a clone of this SerialBlobOverrides java. Returns a clone of this |
| public boolean | Returns: true if the given object represents a SerialBlob
equivalent to this SerialBlob, false otherwiseThe object to compare this obj)SerialBlob againstOverrides java. Compares this SerialBlob to the specified object. |
| public void | free()
Implements java. This method frees the |
| public InputStream | Returns: ajava.io.InputStream object that contains
this SerialBlob object's array of bytesImplements java. Returns this |
| public InputStream | Returns: InputStream through which the partial Blob value can
be read.the offset to the first byte of the partial value to be
retrieved. The first byte in the pos, long Blob is at position 1the length in bytes of the partial value to be retrieved length)Implements java. Returns an
|
| public byte[] | Returns: an array of bytes that is a copy of a region of thisSerialBlob object, starting at the given
position and containing the given number of consecutive bytesthe ordinal position of the first byte in this
pos, int SerialBlob object to be copied;
numbering starts at 1; must not be less
than 1 and must be less than or equal
to the length of this SerialBlob objectthe number of bytes to be copied length)Implements java. Copies the specified number of bytes, starting at the given
position, from this |
| public int | Returns: a hash code value for this object.Overrides java. Returns a hash code for this |
| private void | |
| public long | Returns: along indicating the length in bytes of this
SerialBlob object's array of bytesImplements java. Retrieves the number of bytes in this |
| public long | Returns: the position in thisSerialBlob object
where the given pattern begins, starting at the specified
position; -1 if the pattern is not found
or the given starting position is out of bounds; position
numbering for the return value starts at 1the pattern of bytes for which to search pattern, long the position of the byte in this
start)SerialBlob object from which to begin
the search; the first position is 1;
must not be less than 1 nor greater than
the length of this SerialBlob objectImplements java. Returns the position in this |
| public long | Returns: the position in thisSerialBlob object
where the given Blob object begins, starting
at the specified position; -1 if the pattern is
not found or the given starting position is out of bounds;
position numbering for the return value starts at 1the pattern, long Blob object for which to search;the position of the byte in this
start)SerialBlob object from which to begin
the search; the first position is 1;
must not be less than 1 nor greater than
the length of this SerialBlob objectImplements java. Returns the position in this |
| private void | readObject(ObjectInputStream
the s)ObjectInputStream to read from.readObject is called to restore the state of the SerialBlob from a stream. |
| public OutputStream | Returns: ajava.io.OutputStream object to which data can
be writtenthe position in the pos)BLOB value at which
to start writingImplements java. Retrieves a stream that can be used to write to the |
| public int | Returns: the number of bytes writtenthe position in the SQL pos, byte[] BLOB value at which
to start writing. The first position is 1;
must not be less than 1 nor greater than
the length+1 of this SerialBlob object.the array of bytes to be written to the bytes)BLOB
value that this Blob object representsImplements java. Writes the given array of bytes to the |
| public int | Returns: the number of bytes writtenthe position in the pos, byte[] BLOB object at which
to start writing. The first position is 1;
must not be less than 1 nor greater than
the length+1 of this SerialBlob object.the array of bytes to be written to the bytes, int BLOB
valuethe offset into the array offset, int bytes at which
to start reading the bytes to be set. The first offset position is
0; must not be less than 0 nor greater
than the length of the array bytesthe number of bytes to be written to the
length)BLOB value from the array of bytes bytesImplements java. Writes all or part of the given |
| public void | truncate(long
the length, in bytes, to which the length)BLOB
value that this Blob object represents should be
truncatedImplements java. Truncates the |
| private void | writeObject(ObjectOutputStream
the s)ObjectOutputStream to write to.writeObject is called to save the state of the SerialBlob to a stream. |
| blob | back to summary |
|---|---|
private Blob blob
| |
| buf | back to summary |
|---|---|
| private byte[] buf A serialized array of uninterpreted bytes representing the
value of this | |
| len | back to summary |
|---|---|
| private long len The number of bytes in this | |
| origLen | back to summary |
|---|---|
| private long origLen The original number of bytes in this | |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID The identifier that assists in the serialization of this
| |
| SerialBlob | back to summary |
|---|---|
| public SerialBlob(byte[] b) throws SerialException, SQLException Constructs a
The new
| |
| SerialBlob | back to summary |
|---|---|
| public SerialBlob(Blob blob) throws SerialException, SQLException Constructs a
The new
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Returns a clone of this
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Compares this SerialBlob to the specified object. The result is
| |
| free | back to summary |
|---|---|
| public void free() throws SQLException Implements java. This method frees the If
| |
| getBinaryStream | back to summary |
|---|---|
| public InputStream getBinaryStream() throws SerialException Implements java. Returns this
| |
| getBinaryStream | back to summary |
|---|---|
| public InputStream getBinaryStream(long pos, long length) throws SQLException Implements java. Returns an
| |
| getBytes | back to summary |
|---|---|
| public byte[] getBytes(long pos, int length) throws SerialException Implements java. Copies the specified number of bytes, starting at the given
position, from this
Note that if the given number of bytes to be copied is larger than
the length of this
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hash code for this
| |
| isValid | back to summary |
|---|---|
| private void isValid() throws SerialException Check to see if this object had previously had its | |
| length | back to summary |
|---|---|
| public long length() throws SerialException Implements java. Retrieves the number of bytes in this
| |
| position | back to summary |
|---|---|
| public long position(byte[] pattern, long start) throws SerialException, SQLException Implements java. Returns the position in this
| |
| position | back to summary |
|---|---|
| public long position(Blob pattern, long start) throws SerialException, SQLException Implements java. Returns the position in this
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException readObject is called to restore the state of the SerialBlob from a stream.
| |
| setBinaryStream | back to summary |
|---|---|
| public OutputStream setBinaryStream(long pos) throws SerialException, SQLException Implements java. Retrieves a stream that can be used to write to the
| |
| setBytes | back to summary |
|---|---|
| public int setBytes(long pos, byte[] bytes) throws SerialException, SQLException Implements java. Writes the given array of bytes to the
| |
| setBytes | back to summary |
|---|---|
| public int setBytes(long pos, byte[] bytes, int offset, int length) throws SerialException, SQLException Implements java. Writes all or part of the given
| |
| truncate | back to summary |
|---|---|
| public void truncate(long length) throws SerialException Implements java. Truncates the
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream s) throws IOException writeObject is called to save the state of the SerialBlob to a stream.
| |