com.metamatrix.common.types
Class BlobType

java.lang.Object
  extended by com.metamatrix.common.types.Streamable<java.sql.Blob>
      extended by com.metamatrix.common.types.BlobType
All Implemented Interfaces:
java.io.Serializable, java.sql.Blob

public final class BlobType
extends Streamable<java.sql.Blob>
implements java.sql.Blob

Represent a value of type "blob", which can be streamable from client

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.metamatrix.common.types.Streamable
FORCE_STREAMING, reference, STREAMING_BATCH_SIZE_IN_BYTES
 
Constructor Summary
BlobType(java.sql.Blob blob)
           
 
Method Summary
static javax.sql.rowset.serial.SerialBlob createBlob(byte[] bytes)
           
 void free()
           
 java.io.InputStream getBinaryStream()
           
 java.io.InputStream getBinaryStream(long pos, long length)
           
static byte[] getByteArray(java.sql.Blob blob)
          Utility Method to convert blob into byte array
 byte[] getBytes(long pos, int length)
           
 long length()
           
 long position(java.sql.Blob pattern, long start)
           
 long position(byte[] pattern, long start)
           
 java.io.OutputStream setBinaryStream(long pos)
           
 int setBytes(long pos, byte[] bytes)
           
 int setBytes(long pos, byte[] bytes, int offset, int len)
           
 void truncate(long len)
           
 
Methods inherited from class com.metamatrix.common.types.Streamable
equals, getPersistenceStreamId, getReference, getReferenceStreamId, setPersistenceStreamId, setReference, setReferenceStreamId, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlobType

public BlobType(java.sql.Blob blob)
Method Detail

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Specified by:
getBinaryStream in interface java.sql.Blob
Throws:
java.sql.SQLException
See Also:
Blob.getBinaryStream()

getBytes

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

length

public long length()
            throws java.sql.SQLException
Specified by:
length in interface java.sql.Blob
Throws:
java.sql.SQLException
See Also:
Blob.length()

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
See Also:
Blob.position(java.sql.Blob, long)

position

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

setBinaryStream

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

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
Since:
4.3
See Also:
Blob.setBytes(long, byte[], int, int)

setBytes

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

truncate

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

getByteArray

public static byte[] getByteArray(java.sql.Blob blob)
                           throws java.sql.SQLException,
                                  java.io.IOException
Utility Method to convert blob into byte array

Parameters:
blob -
Returns:
byte array
Throws:
java.sql.SQLException
java.io.IOException

free

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

getBinaryStream

public java.io.InputStream getBinaryStream(long pos,
                                           long length)
                                    throws java.sql.SQLException
Specified by:
getBinaryStream in interface java.sql.Blob
Throws:
java.sql.SQLException

createBlob

public static javax.sql.rowset.serial.SerialBlob createBlob(byte[] bytes)


Copyright © 2009. All Rights Reserved.