Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.client.am
Class Blob  view Blob download Blob.java

java.lang.Object
  extended byorg.apache.derby.client.am.Lob
      extended byorg.apache.derby.client.am.Blob
All Implemented Interfaces:
java.sql.Blob, UnitOfWorkListener

public class Blob
extends Lob
implements java.sql.Blob


Field Summary
(package private)  java.io.InputStream binaryStream_
           
(package private)  byte[] binaryString_
           
(package private)  int dataOffset_
           
 
Fields inherited from class org.apache.derby.client.am.Lob
agent_, ASCII_STREAM, BINARY_STREAM, BINARY_STRING, CHARACTER_STREAM, dataType_, lengthObtained_, sqlLength_, STRING, UNICODE_STREAM
 
Constructor Summary
Blob(Agent agent, java.io.InputStream binaryStream, int length)
           
Blob(byte[] binaryString, Agent agent, int dataOffset)
           
 
Method Summary
protected  long binaryStringPosition(byte[] pattern, long start)
           
 java.io.InputStream getBinaryStream()
          This method returns a stream that will read the bytes of this Blob.
private  java.io.InputStream getBinaryStreamX()
           
 byte[] getBinaryString()
           
 byte[] getBytes(long pos, int length)
          This method returns up to the requested bytes of this Blob as a byte array.
private  byte[] getBytesX(long pos, int length)
           
 boolean isBinaryStream()
           
 boolean isBinaryString()
           
protected  boolean isSubString(byte[] pattern, int index)
           
 long length()
          This method returns the number of bytes in this Blob.
 long position(java.sql.Blob pattern, long start)
          This method returns the index into this Blob at which the first instance of the specified pattern occurs.
 long position(byte[] pattern, long start)
          This method returns the index into this Blob at which the first instance of the specified bytes occur.
private  long positionX(java.sql.Blob pattern, long start)
           
private  long positionX(byte[] pattern, long start)
           
 java.io.OutputStream setBinaryStream(long pos)
          Returns a binary stream that writes into this Blob, starting at the specified index.
 int setBytes(long pos, byte[] bytes)
          Writes the specified data into this Blob, starting at the specified index.
 int setBytes(long pos, byte[] bytes, int offset, int len)
          Writes a portion of the specified data into this Blob, starting at the specified index.
 int setBytesX(long pos, byte[] bytes, int offset, int len)
           
 void truncate(long len)
          Truncates this Blob to be at most the specified number of bytes long.
 
Methods inherited from class org.apache.derby.client.am.Lob
checkForClosedConnection, completeLocalCommit, completeLocalCommit, completeLocalRollback, completeLocalRollback, finalize, getAgent, listenToUnitOfWork, sqlLength
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

binaryString_

byte[] binaryString_

binaryStream_

java.io.InputStream binaryStream_

dataOffset_

int dataOffset_
Constructor Detail

Blob

public Blob(byte[] binaryString,
            Agent agent,
            int dataOffset)

Blob

public Blob(Agent agent,
            java.io.InputStream binaryStream,
            int length)
Method Detail

length

public long length()
            throws SqlException
Description copied from interface: java.sql.Blob
This method returns the number of bytes in this Blob.

Specified by:
length in interface java.sql.Blob

getBytes

public byte[] getBytes(long pos,
                       int length)
                throws SqlException
Description copied from interface: java.sql.Blob
This method returns up to the requested bytes of this Blob as a byte array.

Specified by:
getBytes in interface java.sql.Blob

getBytesX

private byte[] getBytesX(long pos,
                         int length)
                  throws SqlException

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws SqlException
Description copied from interface: java.sql.Blob
This method returns a stream that will read the bytes of this Blob.

Specified by:
getBinaryStream in interface java.sql.Blob

getBinaryStreamX

private java.io.InputStream getBinaryStreamX()
                                      throws SqlException

position

public long position(byte[] pattern,
                     long start)
              throws SqlException
Description copied from interface: java.sql.Blob
This method returns the index into this Blob at which the first instance of the specified bytes occur. The searching starts at the specified index into this Blob.

Specified by:
position in interface java.sql.Blob

positionX

private long positionX(byte[] pattern,
                       long start)
                throws SqlException

position

public long position(java.sql.Blob pattern,
                     long start)
              throws SqlException
Description copied from interface: java.sql.Blob
This method returns the index into this Blob at which the first instance of the specified pattern occurs. The searching starts at the specified index into this Blob. The bytes in the specified Blob are used as the search pattern.

Specified by:
position in interface java.sql.Blob

positionX

private long positionX(java.sql.Blob pattern,
                       long start)
                throws SqlException

setBytes

public int setBytes(long pos,
                    byte[] bytes)
             throws SqlException
Description copied from interface: java.sql.Blob
Writes the specified data into this Blob, starting at the specified index.

Specified by:
setBytes in interface java.sql.Blob

setBytes

public int setBytes(long pos,
                    byte[] bytes,
                    int offset,
                    int len)
             throws SqlException
Description copied from interface: java.sql.Blob
Writes a portion of the specified data into this Blob, starting at the specified index.

Specified by:
setBytes in interface java.sql.Blob

setBytesX

public int setBytesX(long pos,
                     byte[] bytes,
                     int offset,
                     int len)
              throws SqlException

setBinaryStream

public java.io.OutputStream setBinaryStream(long pos)
                                     throws SqlException
Description copied from interface: java.sql.Blob
Returns a binary stream that writes into this Blob, starting at the specified index.

Specified by:
setBinaryStream in interface java.sql.Blob

truncate

public void truncate(long len)
              throws SqlException
Description copied from interface: java.sql.Blob
Truncates this Blob to be at most the specified number of bytes long.

Specified by:
truncate in interface java.sql.Blob

isBinaryString

public boolean isBinaryString()

isBinaryStream

public boolean isBinaryStream()

getBinaryString

public byte[] getBinaryString()

binaryStringPosition

protected long binaryStringPosition(byte[] pattern,
                                    long start)

isSubString

protected boolean isSubString(byte[] pattern,
                              int index)