Package org.apache.derby.iapi.types
Class HarmonySerialBlob
- java.lang.Object
-
- org.apache.derby.iapi.types.HarmonySerialBlob
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.sql.Blob
public class HarmonySerialBlob extends java.lang.Object implements java.sql.Blob, java.io.Serializable, java.lang.CloneableCopied from the Harmony project's implementation of javax.sql.rowset.serial.SerialBlob at subversion revision 946981.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.sql.Blobblobprivate byte[]bufprivate longlenprivate longorigLenprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description HarmonySerialBlob(byte[] buf)Constructs an instance by the givenbufHarmonySerialBlob(java.sql.Blob blob)Constructs an instance by the givenblob
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfree()java.io.InputStreamgetBinaryStream()Returns an input stream of this SerialObject.java.io.InputStreamgetBinaryStream(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 java.sql.SQLExceptionmakeSQLException(java.lang.String messageID, java.lang.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.longposition(java.sql.Blob pattern, long start)Search for the position in this Blob at which a specified pattern begins, starting at a specified position within the Blob.java.io.OutputStreamsetBinaryStream(long pos)intsetBytes(long pos, byte[] theBytes)intsetBytes(long pos, byte[] theBytes, int offset, int length)voidtruncate(long length)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
buf
private byte[] buf
-
blob
private java.sql.Blob blob
-
len
private long len
-
origLen
private long origLen
-
-
Constructor Detail
-
HarmonySerialBlob
public HarmonySerialBlob(java.sql.Blob blob) throws java.sql.SQLExceptionConstructs an instance by the givenblob- Parameters:
blob- the given blob- Throws:
java.sql.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 Detail
-
getBinaryStream
public java.io.InputStream getBinaryStream() throws java.sql.SQLExceptionReturns an input stream of this SerialObject.- Specified by:
getBinaryStreamin interfacejava.sql.Blob- Throws:
java.sql.SQLException- if an error is encountered
-
getBytes
public byte[] getBytes(long pos, int length) throws java.sql.SQLExceptionReturns 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 interfacejava.sql.Blob- Parameters:
pos- the starting position of the array to be copied.length- the total length of bytes to be copied- Throws:
java.sql.SQLException- if an error is encountered
-
length
public long length() throws java.sql.SQLExceptionGets the number of bytes in this SerialBlob object.- Specified by:
lengthin interfacejava.sql.Blob- Returns:
- an long value with the length of the SerialBlob in bytes
- Throws:
java.sql.SQLException- if an error is encoutnered
-
position
public long position(java.sql.Blob pattern, long start) throws java.sql.SQLExceptionSearch for the position in this Blob at which a specified pattern begins, starting at a specified position within the Blob.- Specified by:
positionin interfacejava.sql.Blob- 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:
java.sql.SQLException- if an error occurs accessing the Blob, or if an error is encountered
-
position
public long position(byte[] pattern, long start) throws java.sql.SQLExceptionSearch for the position in this Blob at which the specified pattern begins, starting at a specified position within the Blob.- Specified by:
positionin interfacejava.sql.Blob- 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:
java.sql.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
public java.io.OutputStream setBinaryStream(long pos) throws java.sql.SQLException- Specified by:
setBinaryStreamin interfacejava.sql.Blob- Throws:
java.sql.SQLException
-
setBytes
public int setBytes(long pos, byte[] theBytes) throws java.sql.SQLException- Specified by:
setBytesin interfacejava.sql.Blob- Throws:
java.sql.SQLException
-
setBytes
public int setBytes(long pos, byte[] theBytes, int offset, int length) throws java.sql.SQLException- Specified by:
setBytesin interfacejava.sql.Blob- Throws:
java.sql.SQLException
-
truncate
public void truncate(long length) throws java.sql.SQLException- Specified by:
truncatein interfacejava.sql.Blob- Throws:
java.sql.SQLException
-
free
public void free() throws java.sql.SQLException- Specified by:
freein interfacejava.sql.Blob- Throws:
java.sql.SQLException
-
getBinaryStream
public java.io.InputStream getBinaryStream(long pos, long length) throws java.sql.SQLException- Specified by:
getBinaryStreamin interfacejava.sql.Blob- Throws:
java.sql.SQLException
-
makeSQLException
public static java.sql.SQLException makeSQLException(java.lang.String messageID, java.lang.Object[] args)Create a SQLException from Derby message arguments.
-
-