org.apache.derbyTesting.functionTests.tests.largedata
Class BlobImpl

java.lang.Object
  extended by org.apache.derbyTesting.functionTests.tests.largedata.BlobImpl
All Implemented Interfaces:
java.sql.Blob

 class BlobImpl
extends java.lang.Object
implements java.sql.Blob

Class to simulate a 4Gb blob impl in order to test if Derby handles such large blobs correctly. The main methods here are only the length() and the getBinaryStream(). Rest are just placeholders/dummy methods in order to implement the java.sql.Blob interface ---- Derby throws an error if the blob length exceeds the max range of int.


Field Summary
(package private)  long length
           
(package private)  java.io.InputStream myStream
           
 
Constructor Summary
BlobImpl(java.io.InputStream is, long length)
           
 
Method Summary
 java.io.InputStream getBinaryStream()
           
 byte[] getBytes()
           
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Blob
free, getBinaryStream
 

Field Detail

length

long length

myStream

java.io.InputStream myStream
Constructor Detail

BlobImpl

public BlobImpl(java.io.InputStream is,
                long length)
Method Detail

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

truncate

public void truncate(long len)
              throws java.sql.SQLException
Specified by:
truncate 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

Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.