Top Description Fields Constructors Methods
org.apache.derby.impl.load

pack-priv Class ImportBlob

extends Object
implements Blob
Class Inheritance
All Implemented Interfaces
java.sql.Blob
Imports
org.apache.derby.iapi.services.io.LimitInputStream, org.apache.derby.iapi.util.StringUtil, java.sql.Blob, .SQLException, java.io.InputStream

This class implements java.sql.BLOB interface . Objects created using the ImportBlob class are intended to be be used to create a blob object of the data stored in an import file or as an hex string. Only the routines that are needed read the blob data for the blob columns by the inserts done through the VTI have real implementations, Other routines are dummy ones to satisfy java.sql.Blob interface.

Field Summary

Modifier and TypeField and Description
private byte[]
private long
private long
private ImportLobFile

Constructor Summary

AccessConstructor and Description
public
ImportBlob(ImportLobFile
lob file resource object, using which data is read.
lobFile
,
long
byte offset in the file, of this blob columb data.
position
,
long
length of this blob object data.
length
)

Create a import Blob object, that reads length amount of data from an external file, starting at position .

public
ImportBlob(byte[]
byte array that contains the blob data.
data
)

Create a import Blob object, whose value is the give hex data string.

Method Summary

Modifier and TypeMethod and Description
public void
free()

Implements java.sql.Blob.free.

Raise error, not used by import

public InputStream

Returns:

a stream containing the BLOB data
getBinaryStream
()

Implements java.sql.Blob.getBinaryStream.

Returns BLOB value designated by this Blob object as a input stream.

public InputStream
getBinaryStream(long
the offset to the first byte of the partial value to be retrieved. The first byte in the Blob is at position 1.
pos
,
long
the length in bytes of the partial value to be retrieved
length
)

Implements java.sql.Blob.getBinaryStream.

Raise error, not used by import

public byte[]
getBytes(long
the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1
pos
,
int
the number of consecutive bytes to be copied; the value for length must be 0 or greater
length
)

Implements java.sql.Blob.getBytes.

This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.

public long

Returns:

length of the BLOB in bytes
length
()

Implements java.sql.Blob.length.

Returns the number of bytes in this BLOB object.

private SQLException
methodNotImplemented()

Return an unimplemented feature error

public long
position(byte[]
the byte array for which to search
pattern
,
long
the position at which to begin searching; the first position is 1
start
)

Implements java.sql.Blob.position.

This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.

public long
position(Blob
the Blob object designating the BLOB value for which to search
pattern
,
long
the position in the BLOB value at which to begin searching; the first position is 1
start
)

Implements java.sql.Blob.position.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

public OutputStream
setBinaryStream(long
the position in the BLOB value at which to start writing; the first position is 1
pos
)

Implements java.sql.Blob.setBinaryStream.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

public int
setBytes(long
the position in the BLOB object at which to start writing; the first position is 1
pos
,
byte[]
the array of bytes to be written to the BLOB value that this Blob object represents
bytes
)

Implements java.sql.Blob.setBytes.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

public int
setBytes(long
the position in the BLOB object at which to start writing; the first position is 1
pos
,
byte[]
the array of bytes to be written to this BLOB object
bytes
,
int
the offset into the array bytes at which to start reading the bytes to be set
offset
,
int
the number of bytes to be written to the BLOB value from the array of bytes bytes
len
)

Implements java.sql.Blob.setBytes.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

public void
truncate(long
the length, in bytes, to which the BLOB value that this Blob object represents should be truncated
len
)

Implements java.sql.Blob.truncate.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blobDataback to summary
private byte[] blobData
blobLengthback to summary
private long blobLength
blobPositionback to summary
private long blobPosition
lobFileback to summary
private ImportLobFile lobFile

Constructor Detail

ImportBlobback to summary
public ImportBlob(ImportLobFile lobFile, long position, long length)

Create a import Blob object, that reads length amount of data from an external file, starting at position .

Parameters
lobFile:ImportLobFile

lob file resource object, using which data is read.

position:long

byte offset in the file, of this blob columb data.

length:long

length of this blob object data.

ImportBlobback to summary
public ImportBlob(byte[] data)

Create a import Blob object, whose value is the give hex data string.

Parameters
data:byte[]

byte array that contains the blob data.

Method Detail

freeback to summary
public void free() throws SQLException

Implements java.sql.Blob.free.

Raise error, not used by import

Exceptions
SQLException:

Doc from java.sql.Blob.free.

if an error occurs releasing the Blob's resources

getBinaryStreamback to summary
public InputStream getBinaryStream() throws SQLException

Implements java.sql.Blob.getBinaryStream.

Returns BLOB value designated by this Blob object as a input stream.

Returns:InputStream

a stream containing the BLOB data

Exceptions
SQLException:
if any error occurs while setting up this blob data in the import file as stream.
getBinaryStreamback to summary
public InputStream getBinaryStream(long pos, long length) throws SQLException

Implements java.sql.Blob.getBinaryStream.

Raise error, not used by import

Parameters
pos:long

Doc from java.sql.Blob.getBinaryStream.

the offset to the first byte of the partial value to be retrieved. The first byte in the Blob is at position 1.

length:long

Doc from java.sql.Blob.getBinaryStream.

the length in bytes of the partial value to be retrieved

Returns:InputStream

Doc from java.sql.Blob.getBinaryStream.

InputStream through which the partial Blob value can be read.

Exceptions
SQLException:

Doc from java.sql.Blob.getBinaryStream.

if pos is less than 1 or if pos is greater than the number of bytes in the Blob or if pos + length is greater than the number of bytes in the Blob

getBytesback to summary
public byte[] getBytes(long pos, int length) throws SQLException

Implements java.sql.Blob.getBytes.

This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.

Parameters
pos:long

Doc from java.sql.Blob.getBytes.

the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1

length:int

Doc from java.sql.Blob.getBytes.

the number of consecutive bytes to be copied; the value for length must be 0 or greater

Returns:byte[]

Doc from java.sql.Blob.getBytes.

a byte array containing up to length consecutive bytes from the BLOB value designated by this Blob object, starting with the byte at position pos

Exceptions
SQLException:

Doc from java.sql.Blob.getBytes.

if there is an error accessing the BLOB value; if pos is less than 1 or length is less than 0

See Also
java.sql.Blob
lengthback to summary
public long length() throws SQLException

Implements java.sql.Blob.length.

Returns the number of bytes in this BLOB object.

Returns:long

length of the BLOB in bytes

Exceptions
SQLException:
on any error.
methodNotImplementedback to summary
private SQLException methodNotImplemented()

Return an unimplemented feature error

positionback to summary
public long position(byte[] pattern, long start) throws SQLException

Implements java.sql.Blob.position.

This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.

Parameters
pattern:byte[]

Doc from java.sql.Blob.position.

the byte array for which to search

start:long

Doc from java.sql.Blob.position.

the position at which to begin searching; the first position is 1

Returns:long

Doc from java.sql.Blob.position.

the position at which the pattern appears, else -1

Exceptions
SQLException:

Doc from java.sql.Blob.position.

if there is an error accessing the BLOB or if start is less than 1

See Also
java.sql.Blob
positionback to summary
public long position(Blob pattern, long start) throws SQLException

Implements java.sql.Blob.position.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

Parameters
pattern:Blob

Doc from java.sql.Blob.position.

the Blob object designating the BLOB value for which to search

start:long

Doc from java.sql.Blob.position.

the position in the BLOB value at which to begin searching; the first position is 1

Returns:long

Doc from java.sql.Blob.position.

the position at which the pattern begins, else -1

Exceptions
SQLException:

Doc from java.sql.Blob.position.

if there is an error accessing the BLOB value or if start is less than 1

See Also
java.sql.Blob
setBinaryStreamback to summary
public OutputStream setBinaryStream(long pos) throws SQLException

Implements java.sql.Blob.setBinaryStream.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

Parameters
pos:long

Doc from java.sql.Blob.setBinaryStream.

the position in the BLOB value at which to start writing; the first position is 1

Returns:OutputStream

Doc from java.sql.Blob.setBinaryStream.

a java.io.OutputStream object to which data can be written

Exceptions
SQLException:

Doc from java.sql.Blob.setBinaryStream.

if there is an error accessing the BLOB value or if pos is less than 1

See Also
java.sql.Blob
setBytesback to summary
public int setBytes(long pos, byte[] bytes) throws SQLException

Implements java.sql.Blob.setBytes.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

Parameters
pos:long

Doc from java.sql.Blob.setBytes.

the position in the BLOB object at which to start writing; the first position is 1

bytes:byte[]

Doc from java.sql.Blob.setBytes.

the array of bytes to be written to the BLOB value that this Blob object represents

Returns:int

Doc from java.sql.Blob.setBytes.

the number of bytes written

Exceptions
SQLException:

Doc from java.sql.Blob.setBytes.

if there is an error accessing the BLOB value or if pos is less than 1

See Also
java.sql.Blob
setBytesback to summary
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException

Implements java.sql.Blob.setBytes.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

Parameters
pos:long

Doc from java.sql.Blob.setBytes.

the position in the BLOB object at which to start writing; the first position is 1

bytes:byte[]

Doc from java.sql.Blob.setBytes.

the array of bytes to be written to this BLOB object

offset:int

Doc from java.sql.Blob.setBytes.

the offset into the array bytes at which to start reading the bytes to be set

len:int

Doc from java.sql.Blob.setBytes.

the number of bytes to be written to the BLOB value from the array of bytes bytes

Returns:int

Doc from java.sql.Blob.setBytes.

the number of bytes written

Exceptions
SQLException:

Doc from java.sql.Blob.setBytes.

if there is an error accessing the BLOB value or if pos is less than 1

See Also
java.sql.Blob
truncateback to summary
public void truncate(long len) throws SQLException

Implements java.sql.Blob.truncate.

This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

Parameters
len:long

Doc from java.sql.Blob.truncate.

the length, in bytes, to which the BLOB value that this Blob object represents should be truncated

Exceptions
SQLException:

Doc from java.sql.Blob.truncate.

if there is an error accessing the BLOB value or if len is less than 0

See Also
java.sql.Blob