Package xal.tools.database
Class ConcreteBlob
java.lang.Object
xal.tools.database.ConcreteBlob
- All Implemented Interfaces:
Blob
Concrete implementation of an SQL Blob.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
free()
Get an input stream that can read the BLOB data.getBinaryStream
(long position, long length) byte[]
getBytes
(long position, int length) Get the specified part of the blob data as an array of bytes.long
length()
Get the number of bytes in this BLOB.long
position
(byte[] pattern, long start) Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start.long
Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start.setBinaryStream
(long position) Get an output stream for writing to this BLOB.int
setBytes
(long position, byte[] bytes) Set the specified bytes.int
setBytes
(long position, byte[] bytes, int offset, int length) Set the specified bytes.void
truncate
(long length) Truncate this BLOB to be the specified length.
-
Field Details
-
data
protected byte[] data
-
-
Constructor Details
-
ConcreteBlob
public ConcreteBlob(int capacity) Primary Constructor- Parameters:
capacity
- The number of bytes allocated for data storage.
-
ConcreteBlob
public ConcreteBlob()Constructor
-
-
Method Details
-
getBinaryStream
Get an input stream that can read the BLOB data.- Specified by:
getBinaryStream
in interfaceBlob
- Throws:
SQLException
-
getBinaryStream
- Specified by:
getBinaryStream
in interfaceBlob
-
free
public void free() -
getBytes
public byte[] getBytes(long position, int length) Get the specified part of the blob data as an array of bytes. -
length
public long length()Get the number of bytes in this BLOB. -
position
Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start.- Specified by:
position
in interfaceBlob
- Throws:
SQLException
-
position
public long position(byte[] pattern, long start) Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start. -
setBinaryStream
Get an output stream for writing to this BLOB. This implementation simply throws an unsupported operation exception.- Specified by:
setBinaryStream
in interfaceBlob
-
setBytes
public int setBytes(long position, byte[] bytes, int offset, int length) Set the specified bytes. -
setBytes
public int setBytes(long position, byte[] bytes) Set the specified bytes. -
truncate
public void truncate(long length) Truncate this BLOB to be the specified length.
-