cgl.util
Class MyByteBlob

java.lang.Object
  extended bycgl.util.MyByteBlob
All Implemented Interfaces:
java.sql.Blob

public class MyByteBlob
extends java.lang.Object
implements java.sql.Blob

Screwy wrapper class so that we can insert a Blob into the database from a byte array. Includes more screwy stuff for Oracle specific updating of a blob (the only way to insert a new blob).

Author:
David Wall

Field Summary
(package private)  byte[] bytes
           
 
Constructor Summary
MyByteBlob(java.sql.Blob b)
           
MyByteBlob(byte[] b)
          Creates a YoByteBlob using the specified byte array.
 
Method Summary
 java.io.InputStream getBinaryStream()
           
 byte[] getBytes()
           
 byte[] getBytes(long pos, int length)
           
 long length()
           
static void main(java.lang.String[] args)
           
 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 l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytes

byte[] bytes
Constructor Detail

MyByteBlob

public MyByteBlob(byte[] b)
Creates a YoByteBlob using the specified byte array.


MyByteBlob

public MyByteBlob(java.sql.Blob b)
Method Detail

length

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

getBytes

public byte[] getBytes()

getBytes

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

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Specified by:
getBinaryStream 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

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

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 len)
             throws java.sql.SQLException
Specified by:
setBytes in interface java.sql.Blob
Throws:
java.sql.SQLException

truncate

public void truncate(long l)
Specified by:
truncate in interface java.sql.Blob

main

public static void main(java.lang.String[] args)