org.firebirdsql.jdbc

Class FBCachedBlob

Implemented Interfaces:
Blob, FirebirdBlob

public class FBCachedBlob
extends java.lang.Object
implements FirebirdBlob

This class represents a cached blob field.

Constructor Summary

FBCachedBlob(byte[] data)
Create an instance using the cached data.

Method Summary

FirebirdBlob
detach()
InputStream
getBinaryStream()
Get contents of blob as binary stream.
byte[]
getBytes(long pos, int length)
Get part of the blob field.
boolean
isSegmented()
long
length()
Get the length of the cached blob field.
long
position(Blob pattern, long start)
Find the first entry of the specified pattern.
long
position(byte[] pattern, long start)
Find the first entry of the specified pattern.
OutputStream
setBinaryStream(long pos)
Set the contents of blob as binary stream.
int
setBytes(long l, abyte0[] )
Set contents of the blob.
int
setBytes(long l, abyte0[] , int i, int j)
Set the contents of blob.
void
truncate(long length)
Truncate the blob to specified length.

Constructor Details

FBCachedBlob

public FBCachedBlob(byte[] data)
Create an instance using the cached data.
Parameters:
data - array of bytes containing the cached data.

Method Details

detach

public FirebirdBlob detach()
            throws SQLException
Specified by:
detach in interface FirebirdBlob

getBinaryStream

public InputStream getBinaryStream()
            throws SQLException
Get contents of blob as binary stream.

getBytes

public byte[] getBytes(long pos,
                       int length)
            throws SQLException
Get part of the blob field.
Parameters:
pos - starting position to copy.
length - amount of bytes to copy.

isSegmented

public boolean isSegmented()
            throws SQLException
Specified by:
isSegmented in interface FirebirdBlob

length

public long length()
            throws SQLException
Get the length of the cached blob field.
Returns:
length of the cached blob field or -1 if the field is null.

position

public long position(Blob pattern,
                     long start)
            throws SQLException
Find the first entry of the specified pattern.

position

public long position(byte[] pattern,
                     long start)
            throws SQLException
Find the first entry of the specified pattern.

setBinaryStream

public OutputStream setBinaryStream(long pos)
            throws SQLException
Set the contents of blob as binary stream.
Specified by:
setBinaryStream in interface FirebirdBlob

setBytes

public int setBytes(long l,
                    abyte0[] )
            throws SQLException
Set contents of the blob.

setBytes

public int setBytes(long l,
                    abyte0[] ,
                    int i,
                    int j)
            throws SQLException
Set the contents of blob.

truncate

public void truncate(long length)
            throws SQLException
Truncate the blob to specified length.

Copyright B) 2001 David Jencks and other authors. All rights reserved.