com.altair.hwm.database.sql
Class HWMBlobDB

java.lang.Object
  extended by com.altair.hwm.database.sql.HWMBlobDB
All Implemented Interfaces:
java.io.Serializable, java.sql.Blob

public class HWMBlobDB
extends java.lang.Object
implements java.sql.Blob, java.io.Serializable

Title: HWMBlobDB

Description: The blob implementation for embedded databases

Company: Altair Engineering, Inc.

See Also:
Serialized Form

Constructor Summary
HWMBlobDB()
          Constructor
HWMBlobDB(java.sql.Blob blob)
          Constructor
HWMBlobDB(byte[] arrBytes)
          Constructor
 
Method Summary
 java.io.InputStream getBinaryStream()
          Retrieves the BLOB designated by this Blob instance as a stream.
 byte[] getBytes(long lPos, int nLength)
          Returns as an array of bytes, part or all of the BLOB value that this Blob object designates.
 long length()
          Returns the number of bytes in the BLOB value designated by this Blob object.
 long position(java.sql.Blob blobPattern, long lStart)
          Determines the byte position in the BLOB value designated by this Blob object at which pattern begins.
 long position(byte[] bytearrPattern, long lStart)
          Determines the byte position at which the specified byte pattern begins within the BLOB value that this Blob object represents.
 java.io.OutputStream setBinaryStream(long pos)
           
 int setBytes(long pos, byte[] bytes)
           
 int setBytes(long pos, byte[] bytes, int offset, int len)
           
 java.lang.String toString()
          Returns a string representation of this class
 void truncate(long len)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HWMBlobDB

public HWMBlobDB()
Constructor


HWMBlobDB

public HWMBlobDB(byte[] arrBytes)
Constructor

Parameters:
byte[] - The byte array to store

HWMBlobDB

public HWMBlobDB(java.sql.Blob blob)
          throws java.sql.SQLException
Constructor

Parameters:
blob - The blob to store
Throws:
java.sql.SQLException
Method Detail

toString

public java.lang.String toString()
Returns a string representation of this class

Overrides:
toString in class java.lang.Object
Returns:
String The string representation

length

public long length()
            throws java.sql.SQLException
Returns the number of bytes in the BLOB value designated by this Blob object.

Specified by:
length in interface java.sql.Blob
Returns:
length of the BLOB in bytes
Throws:
java.sql.SQLException - if there is an error accessing the length of the BLOB
Since:
1.2
See Also:
What Is in the JDBC 2.0 API

getBytes

public byte[] getBytes(long lPos,
                       int nLength)
                throws java.sql.SQLException
Returns as an array of bytes, part or all of the BLOB value that this Blob object designates. The byte array contains up to length consecutive bytes starting at position pos.

Specified by:
getBytes in interface java.sql.Blob
Parameters:
lPos - the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1 NOTE: Always returns the entire array of bytes
nLength - the number of consecutive bytes to be copied
Returns:
a byte array containing up to length consecutive bytes from the BLOB value designated by this Blob object, starting with the byte at position pos
Throws:
java.sql.SQLException - if there is an error accessing the BLOB
Since:
1.2
See Also:
What Is in the JDBC 2.0 API

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Retrieves the BLOB designated by this Blob instance as a stream.

Specified by:
getBinaryStream in interface java.sql.Blob
Returns:
a stream containing the BLOB data
Throws:
java.sql.SQLException - if there is an error accessing the BLOB
Since:
1.2
See Also:
What Is in the JDBC 2.0 API

position

public long position(byte[] bytearrPattern,
                     long lStart)
              throws java.sql.SQLException
Determines the byte position at which the specified byte pattern begins within the BLOB value that this Blob object represents. The search for pattern begins at position start.

Specified by:
position in interface java.sql.Blob
Parameters:
bytearrPattern - the byte array for which to search
lStart - the position at which to begin searching; the first position is 1
Returns:
the position at which the pattern appears, else -1
Throws:
java.sql.SQLException - if there is an error accessing the BLOB
Since:
1.2
See Also:
What Is in the JDBC 2.0 API

position

public long position(java.sql.Blob blobPattern,
                     long lStart)
              throws java.sql.SQLException
Determines the byte position in the BLOB value designated by this Blob object at which pattern begins. The search begins at position start.

Specified by:
position in interface java.sql.Blob
Parameters:
blobPattern - the Blob object designating the BLOB value for which to search
lStart - the position in the BLOB value at which to begin searching; the first position is 1
Returns:
the position at which the pattern begins, else -1
Throws:
java.sql.SQLException - if there is an error accessing the BLOB
Since:
1.2
See Also:
What Is in the JDBC 2.0 API

truncate

public void truncate(long len)
              throws java.sql.SQLException
Specified by:
truncate in interface java.sql.Blob
Throws:
java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes)
             throws java.sql.SQLException
Specified by:
setBytes in interface java.sql.Blob
Throws:
java.sql.SQLException

setBytes

public int setBytes(long pos,
                    byte[] bytes,
                    int offset,
                    int len)
             throws java.sql.SQLException
Specified by:
setBytes in interface java.sql.Blob
Throws:
java.sql.SQLException

setBinaryStream

public java.io.OutputStream setBinaryStream(long pos)
                                     throws java.sql.SQLException
Specified by:
setBinaryStream in interface java.sql.Blob
Throws:
java.sql.SQLException