Top Fields Constructors Methods
org.postgresql.jdbc

public Class PgBlob

extends AbstractBlobClob
implements Blob
Class Inheritance
All Implemented Interfaces
java.sql.Blob
Imports
org.postgresql.core.BaseConnection, org.postgresql.largeobject.LargeObject, java.io.InputStream, java.sql.Blob, .SQLException

Field Summary

Inherited from org.postgresql.jdbc.AbstractBlobClob:
connlock

Constructor Summary

AccessConstructor and Description
public
PgBlob(BaseConnection conn, long oid)

Method Summary

Modifier and TypeMethod and Description
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.

Returns an InputStream object that contains a partial Blob value, starting with the byte specified by pos, which is length bytes in length.

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.

Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written.

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.

Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written.

Inherited from org.postgresql.jdbc.AbstractBlobClob:
addSubLOassertPositionassertPositioncheckFreedfreegetBinaryStreamgetBytesgetLolengthpositionpositionsetBinaryStreamtruncate

Constructor Detail

PgBlobback to summary
public PgBlob(BaseConnection conn, long oid) throws SQLException

Method Detail

getBinaryStreamback to summary
public InputStream getBinaryStream(long pos, long length) throws SQLException

Implements java.sql.Blob.getBinaryStream.

Doc from java.sql.Blob.getBinaryStream.

Returns an InputStream object that contains a partial Blob value, starting with the byte specified by pos, which is length bytes in length.

Parameters
pos:long

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

the length in bytes of the partial value to be retrieved

Returns:InputStream

InputStream through which the partial Blob value can be read.

Annotations
@Override
Exceptions
SQLException:
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
setBytesback to summary
public int setBytes(long pos, byte[] bytes) throws SQLException

Implements java.sql.Blob.setBytes.

Doc from java.sql.Blob.setBytes.

Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written. The array of bytes will overwrite the existing bytes in the Blob object starting at the position pos. If the end of the Blob value is reached while writing the array of bytes, then the length of the Blob value will be increased to accommodate the extra bytes.

Note

If the value specified for pos is greater than the length+1 of the BLOB value then the behavior is undefined. Some JDBC drivers may throw an SQLException while other drivers may support this operation.

Parameters
pos:long

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

bytes:byte[]

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

Returns:int

the number of bytes written

Annotations
@Override
Exceptions
SQLException:
if there is an error accessing the BLOB value or if pos is less than 1
setBytesback to summary
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException

Implements java.sql.Blob.setBytes.

Doc from java.sql.Blob.setBytes.

Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written. Writing starts at position pos in the BLOB value; len bytes from the given byte array are written. The array of bytes will overwrite the existing bytes in the Blob object starting at the position pos. If the end of the Blob value is reached while writing the array of bytes, then the length of the Blob value will be increased to accommodate the extra bytes.

Note

If the value specified for pos is greater than the length+1 of the BLOB value then the behavior is undefined. Some JDBC drivers may throw an SQLException while other drivers may support this operation.

Parameters
pos:long

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

bytes:byte[]

the array of bytes to be written to this BLOB object

offset:int

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

len:int

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

Returns:int

the number of bytes written

Annotations
@Override
Exceptions
SQLException:
if there is an error accessing the BLOB value or if pos is less than 1