public class XdevBlob extends Object implements ByteHolder, Serializable, Comparable<ByteHolder>
VirtualTable
.
The XdevBlob holds either an reference to a Blob
object or plain
bytes.
Blob
,
Serialized FormConstructor and Description |
---|
XdevBlob()
Initializes a new instance of
XdevBlob . |
XdevBlob(Blob blob)
Initializes a new instance of
XdevBlob . |
XdevBlob(byte[] bytes)
Initializes a new instance of
XdevBlob . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ByteHolder other)
Compares this
XdevBlob with another ByteHolder . |
boolean |
equals(Object obj) |
InputStream |
getBinaryStream()
Retrieves the BLOB value designated by this Blob instance as a stream.
|
InputStream |
getBinaryStream(int position,
int length)
Returns an InputStream object that contains a partial Blob value,
starting with the byte specified by pos, which is length bytes in length.
|
int |
getByteAt(int index)
Returns the byte value at the specified index position.
|
byte[] |
getBytes(int position,
int length)
Retrieves all or part of the BLOB value that this Blob object represents,
as an array of bytes.
|
int |
hashCode()
Generates a hashcode for this
XdevBlob . |
int |
length()
Returns the number of bytes of this
XdevBlob . |
OutputStream |
setBinaryStream(int position)
Retrieves a stream that can be used to write to the BLOB value that this
Blob object represents.
|
int |
setBytes(int position,
byte[] bytes)
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(int position,
byte[] bytes,
int offset,
int length)
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.
|
byte[] |
toByteArray()
Returns a copied
byte array of this XdevBlob . |
Blob |
toJDBCBlob()
|
String |
toString()
|
void |
truncate(long length)
Truncates the BLOB value that this
XdevBlob object represents to
be len bytes in length. |
public XdevBlob()
XdevBlob
.public XdevBlob(byte[] bytes)
XdevBlob
.bytes
- a byte array initially to be setpublic XdevBlob(Blob blob) throws DBException
XdevBlob
.blob
- a Blob
initially to be set.DBException
- if the specified blob could not be set.public int length()
XdevBlob
.length
in interface ByteHolder
public void truncate(long length) throws DBException
XdevBlob
object represents to
be len bytes in length.length
- the length, in bytes, to which the BLOB value that this Blob
object represents should be truncatedDBException
- if truncate was not successful.public InputStream getBinaryStream() throws DBException
InputStream
containing the BLOB dataDBException
- if there is an error accessing the BLOB valuepublic InputStream getBinaryStream(int position, int length) throws DBException
position
- the offset to the first byte of the partial value to be
retrievedlength
- the length in bytes of the partial value to be retrievedInputStream
through which the partial Blob value can be
read.DBException
- if there is an error accessing the BLOB valuepublic OutputStream setBinaryStream(int position) throws DBException
position
- the position in the BLOB value at which to start writingOutputStream
object to which data can be writtenDBException
- if there is an error accessing the BLOB valuepublic int getByteAt(int index) throws DBException
index
- the index to retrieve the byte from.DBException
- if byte could not be read.public byte[] getBytes(int position, int length) throws DBException
position
- the ordinal position of the first byte in the BLOB value to be
extractedlength
- the number of consecutive bytes to be copied; the value for
length must be 0 or greaterDBException
- if there is an error accessing the BLOB valuepublic int setBytes(int position, byte[] bytes) throws DBException
position
- 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 representsDBException
- if there is an error accessing the BLOB valuepublic int setBytes(int position, byte[] bytes, int offset, int length) throws DBException
position
- 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 setlength
- the number of bytes to be written to the BLOB value from the
array of bytes bytesDBException
- if there is an error accessing the BLOB valuepublic String toString()
public byte[] toByteArray()
byte array
of this XdevBlob
.toByteArray
in interface ByteHolder
byte array
public int compareTo(ByteHolder other)
XdevBlob
with another ByteHolder
.
The length of the ByteHolder
objects is used for this comparison.
compareTo
in interface Comparable<ByteHolder>
other
- the other ByteHolder
.ByteHolder
is greaterByteHolder
is smallerpublic Blob toJDBCBlob() throws DBException
Blob
DBException
- if Blob
could not be created.Copyright © 2003–2023 XDEV Software. All rights reserved.