org.jboss.ejb.plugins.cmp.jdbc
Class ByteArrayBlob
java.lang.Object
org.jboss.ejb.plugins.cmp.jdbc.ByteArrayBlob
- All Implemented Interfaces:
- java.sql.Blob
- public final class ByteArrayBlob
- extends java.lang.Object
- implements java.sql.Blob
The representation (mapping) in the JavaTM
programming language of an SQL BLOB value to an array of bytes.
A ByteArrayBlob contains an internal buffer that contains bytes that may be
read from the stream. The Blob interface provides methods for
getting the length of an SQL BLOB (Binary Large Object) value,
for materializing a BLOB value on the client, and for
determining the position of a pattern of bytes within a BLOB
value. The ByteArrayBlob has static factory methods for construting an
BLOB using either an existing serializable object, or an array
of bytes. This is a nice way to store serialized objects in a relational
field of type SQL BLOB.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteArrayBlob
public ByteArrayBlob(byte[] bytes)
getBinaryStream
public java.io.InputStream getBinaryStream()
throws java.sql.SQLException
- Specified by:
getBinaryStream in interface java.sql.Blob
- Throws:
java.sql.SQLException
getBytes
public byte[] getBytes(long pos,
int length)
throws java.sql.SQLException
- Specified by:
getBytes in interface java.sql.Blob
- Throws:
java.sql.SQLException
length
public long length()
throws java.sql.SQLException
- Specified by:
length in interface java.sql.Blob
- Throws:
java.sql.SQLException
position
public long position(java.sql.Blob pattern,
long start)
throws java.sql.SQLException
- Specified by:
position in interface java.sql.Blob
- Throws:
java.sql.SQLException
position
public long position(byte[] pattern,
long start)
throws java.sql.SQLException
- Specified by:
position 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
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 length)
throws java.sql.SQLException
- Specified by:
setBytes in interface java.sql.Blob
- Throws:
java.sql.SQLException
truncate
public void truncate(long length)
throws java.sql.SQLException
- Specified by:
truncate in interface java.sql.Blob
- Throws:
java.sql.SQLException