com.mockrunner.mock.jdbc
Class MockBlob

java.lang.Object
  extended by com.mockrunner.mock.jdbc.MockBlob
All Implemented Interfaces:
java.lang.Cloneable, java.sql.Blob

public class MockBlob
extends java.lang.Object
implements java.sql.Blob, java.lang.Cloneable

Mock implementation of Blob.


Constructor Summary
MockBlob(byte[] data)
           
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 void free()
           
 java.io.InputStream getBinaryStream()
           
 java.io.InputStream getBinaryStream(long pos, long length)
           
 byte[] getBytes(long pos, int length)
           
 int hashCode()
           
 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)
           
 java.lang.String toString()
           
 void truncate(long len)
           
 boolean wasFreeCalled()
          Returns if free() has been called.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockBlob

public MockBlob(byte[] data)
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(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

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

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

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

setBinaryStream

public java.io.OutputStream setBinaryStream(long pos)
                                     throws java.sql.SQLException
Specified by:
setBinaryStream 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

free

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

wasFreeCalled

public boolean wasFreeCalled()
Returns if free() has been called.

Returns:
true if free() has been called, false otherwise

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object