Class HarmonySerialBlob
java.lang.Object
org.apache.derby.iapi.types.HarmonySerialBlob
- All Implemented Interfaces:
Serializable, Cloneable, Blob
Copied from the Harmony project's implementation of javax.sql.rowset.serial.SerialBlob
at subversion revision 946981.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHarmonySerialBlob(byte[] buf) Constructs an instance by the givenbufHarmonySerialBlob(Blob blob) Constructs an instance by the givenblob -
Method Summary
Modifier and TypeMethodDescriptionvoidfree()Returns an input stream of this SerialObject.getBinaryStream(long pos, long length) byte[]getBytes(long pos, int length) Returns a copied array of this SerialObject, starting at theposwith the givenlengthnumber.longlength()Gets the number of bytes in this SerialBlob object.static SQLExceptionmakeSQLException(String messageID, Object[] args) Create a SQLException from Derby message arguments.private booleanmatch(byte[] bytes, int start, byte[] subBytes) longposition(byte[] pattern, long start) Search for the position in this Blob at which the specified pattern begins, starting at a specified position within the Blob.longSearch for the position in this Blob at which a specified pattern begins, starting at a specified position within the Blob.setBinaryStream(long pos) intsetBytes(long pos, byte[] theBytes) intsetBytes(long pos, byte[] theBytes, int offset, int length) voidtruncate(long length)
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
buf
private byte[] buf -
blob
-
len
private long len -
origLen
private long origLen
-
-
Constructor Details
-
HarmonySerialBlob
Constructs an instance by the givenblob- Parameters:
blob- the given blob- Throws:
SQLException- if an error is encountered during serialization, or ifblobis null
-
HarmonySerialBlob
public HarmonySerialBlob(byte[] buf) Constructs an instance by the givenbuf- Parameters:
buf- the given buffer
-
-
Method Details
-
getBinaryStream
Returns an input stream of this SerialObject.- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException- if an error is encountered
-
getBytes
Returns a copied array of this SerialObject, starting at theposwith the givenlengthnumber. Ifpos+length- 1 is larger than the length of this SerialObject array, thelengthwill be shortened to the length of array -pos+ 1.- Specified by:
getBytesin interfaceBlob- Parameters:
pos- the starting position of the array to be copied.length- the total length of bytes to be copied- Throws:
SQLException- if an error is encountered
-
length
Gets the number of bytes in this SerialBlob object.- Specified by:
lengthin interfaceBlob- Returns:
- an long value with the length of the SerialBlob in bytes
- Throws:
SQLException- if an error is encoutnered
-
position
Search for the position in this Blob at which a specified pattern begins, starting at a specified position within the Blob.- Specified by:
positionin interfaceBlob- Parameters:
pattern- a Blob containing the pattern of data to search for in this Blobstart- the position within this Blob to start the search, where the first position in the Blob is 1- Returns:
- a long value with the position at which the pattern begins. -1 if the pattern is not found in this Blob.
- Throws:
SQLException- if an error occurs accessing the Blob, or if an error is encountered
-
position
Search for the position in this Blob at which the specified pattern begins, starting at a specified position within the Blob.- Specified by:
positionin interfaceBlob- Parameters:
pattern- a byte array containing the pattern of data to search for in this Blobstart- the position within this Blob to start the search, where the first position in the Blob is 1- Returns:
- a long value with the position at which the pattern begins. -1 if the pattern is not found in this Blob.
- Throws:
SQLException- if an error is encountered, or if an error occurs accessing the Blob
-
match
private boolean match(byte[] bytes, int start, byte[] subBytes) -
setBinaryStream
- Specified by:
setBinaryStreamin interfaceBlob- Throws:
SQLException
-
setBytes
- Specified by:
setBytesin interfaceBlob- Throws:
SQLException
-
setBytes
- Specified by:
setBytesin interfaceBlob- Throws:
SQLException
-
truncate
- Specified by:
truncatein interfaceBlob- Throws:
SQLException
-
free
- Specified by:
freein interfaceBlob- Throws:
SQLException
-
getBinaryStream
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
makeSQLException
Create a SQLException from Derby message arguments.
-