Package org.apache.derby.iapi.types
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 givenbuf
HarmonySerialBlob
(Blob blob) Constructs an instance by the givenblob
-
Method Summary
Modifier and TypeMethodDescriptionvoid
free()
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 thepos
with the givenlength
number.long
length()
Gets the number of bytes in this SerialBlob object.static SQLException
makeSQLException
(String messageID, Object[] args) Create a SQLException from Derby message arguments.private boolean
match
(byte[] bytes, int start, byte[] subBytes) long
position
(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.long
Search for the position in this Blob at which a specified pattern begins, starting at a specified position within the Blob.setBinaryStream
(long pos) int
setBytes
(long pos, byte[] theBytes) int
setBytes
(long pos, byte[] theBytes, int offset, int length) void
truncate
(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 ifblob
is 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:
getBinaryStream
in interfaceBlob
- Throws:
SQLException
- if an error is encountered
-
getBytes
Returns a copied array of this SerialObject, starting at thepos
with the givenlength
number. Ifpos
+length
- 1 is larger than the length of this SerialObject array, thelength
will be shortened to the length of array -pos
+ 1.- Specified by:
getBytes
in 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:
length
in 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:
position
in 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:
position
in 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:
setBinaryStream
in interfaceBlob
- Throws:
SQLException
-
setBytes
- Specified by:
setBytes
in interfaceBlob
- Throws:
SQLException
-
setBytes
- Specified by:
setBytes
in interfaceBlob
- Throws:
SQLException
-
truncate
- Specified by:
truncate
in interfaceBlob
- Throws:
SQLException
-
free
- Specified by:
free
in interfaceBlob
- Throws:
SQLException
-
getBinaryStream
- Specified by:
getBinaryStream
in interfaceBlob
- Throws:
SQLException
-
makeSQLException
Create a SQLException from Derby message arguments.
-