站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

ByteArrayBlob (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.ejb.plugins.cmp.jdbc
Class ByteArrayBlob

java.lang.Object
  extended byorg.jboss.ejb.plugins.cmp.jdbc.ByteArrayBlob
All Implemented Interfaces:
Blob

public final class ByteArrayBlob
extends Object
implements 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.

Version:
$Revision: 1.5 $
Author:
Andrew McCulloch

Constructor Summary
ByteArrayBlob(byte[] bytes)
           
 
Method Summary
 InputStream getBinaryStream()
           
 byte[] getBytes(long pos, int length)
           
 long length()
           
 long position(Blob pattern, long start)
           
 long position(byte[] pattern, long start)
           
 OutputStream setBinaryStream(long pos)
           
 int setBytes(long pos, byte[] bytes)
           
 int setBytes(long pos, byte[] bytes, int offset, int length)
           
 void truncate(long length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayBlob

public ByteArrayBlob(byte[] bytes)
Method Detail

getBinaryStream

public InputStream getBinaryStream()
                            throws SQLException
Specified by:
getBinaryStream in interface Blob
Throws:
SQLException

getBytes

public byte[] getBytes(long pos,
                       int length)
                throws SQLException
Specified by:
getBytes in interface Blob
Throws:
SQLException

length

public long length()
            throws SQLException
Specified by:
length in interface Blob
Throws:
SQLException

position

public long position(Blob pattern,
                     long start)
              throws SQLException
Specified by:
position in interface Blob
Throws:
SQLException

position

public long position(byte[] pattern,
                     long start)
              throws SQLException
Specified by:
position in interface Blob
Throws:
SQLException

setBinaryStream

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

setBytes

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

setBytes

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

truncate

public void truncate(long length)
              throws SQLException
Specified by:
truncate in interface Blob
Throws:
SQLException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.