public final class FBBlob extends java.lang.Object implements FirebirdBlob, TransactionListener
Blob
.Modifier and Type | Class and Description |
---|---|
static class |
FBBlob.Config
Standard configuration for blobs.
|
FirebirdBlob.BlobInputStream, FirebirdBlob.BlobOutputStream
Constructor and Description |
---|
FBBlob(GDSHelper c)
Deprecated.
will be removed in Jaybird 6, use
FBBlob(GDSHelper, FBObjectListener.BlobListener, Config) |
FBBlob(GDSHelper c,
FBObjectListener.BlobListener blobListener)
Deprecated.
will be removed in Jaybird 6, use
FBBlob(GDSHelper, FBObjectListener.BlobListener, Config) |
FBBlob(GDSHelper c,
FBObjectListener.BlobListener blobListener,
FBBlob.Config config)
Create new Blob instance.
|
FBBlob(GDSHelper c,
long blobId)
Deprecated.
will be removed in Jaybird 6, use
FBBlob(GDSHelper, long, FBObjectListener.BlobListener, Config) |
FBBlob(GDSHelper c,
long blobId,
FBObjectListener.BlobListener blobListener)
Deprecated.
will be removed in Jaybird 6, use
FBBlob(GDSHelper, long, FBObjectListener.BlobListener, Config) |
FBBlob(GDSHelper c,
long blobId,
FBObjectListener.BlobListener blobListener,
FBBlob.Config config)
Create instance of this class to access existing Blob.
|
Modifier and Type | Method and Description |
---|---|
void |
copyBytes(byte[] bytes,
int pos,
int len) |
void |
copyCharacterStream(java.io.Reader reader)
Copy data from a character stream into this Blob.
|
void |
copyCharacterStream(java.io.Reader reader,
Encoding encoding)
Copy data from a character stream into this Blob.
|
void |
copyCharacterStream(java.io.Reader reader,
long length)
Copy data from a character stream into this Blob.
|
void |
copyCharacterStream(java.io.Reader reader,
long length,
Encoding encoding)
Copy data from a character stream into this Blob.
|
void |
copyStream(java.io.InputStream inputStream)
Copy the contents of an
InputStream into this Blob. |
void |
copyStream(java.io.InputStream inputStream,
long length)
Copy the contents of an
InputStream into this Blob. |
static FBBlob.Config |
createConfig(FieldDescriptor fieldDescriptor,
DatabaseConnectionProperties connectionProperties)
Creates a blob configuration from a field descriptor and connection properties.
|
static FBBlob.Config |
createConfig(int subType,
boolean useStreamBlob,
int blobBufferSize,
DatatypeCoder datatypeCoder)
Create a blob configuration.
|
static FBBlob.Config |
createConfig(int subType,
DatabaseConnectionProperties connectionProperties,
DatatypeCoder datatypeCoder)
Creates a blob configuration from a subtype and connection properties and datatype coder.
|
FirebirdBlob |
detach()
Detach this blob.
|
void |
free() |
java.io.InputStream |
getBinaryStream() |
java.io.InputStream |
getBinaryStream(long pos,
long length) |
long |
getBlobId()
Get the identifier for this
Blob |
byte[] |
getBytes(long pos,
int length) |
byte[] |
getInfo(byte[] items,
int buffer_length)
Get information about this Blob.
|
boolean |
isSegmented()
Check if blob is segmented.
|
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) |
void |
transactionStateChanged(FbTransaction transaction,
TransactionState newState,
TransactionState previousState)
Signals that the transaction state changed.
|
void |
truncate(long len) |
@Deprecated public FBBlob(GDSHelper c, FBObjectListener.BlobListener blobListener)
FBBlob(GDSHelper, FBObjectListener.BlobListener, Config)
c
- connection that will be used to write data to blobblobListener
- Blob listener instancepublic FBBlob(GDSHelper c, FBObjectListener.BlobListener blobListener, FBBlob.Config config)
c
- connection that will be used to write data to blobblobListener
- Blob listener instanceconfig
- blob configuration (null
allowed in Jaybird 5, will be disallowed in Jaybird 6)@Deprecated public FBBlob(GDSHelper c)
FBBlob(GDSHelper, FBObjectListener.BlobListener, Config)
c
- connection that will be used to write data to blob.@Deprecated public FBBlob(GDSHelper c, long blobId, FBObjectListener.BlobListener blobListener)
FBBlob(GDSHelper, long, FBObjectListener.BlobListener, Config)
c
- connection that will be used to access Blob.blobId
- ID of the Blob.blobListener
- blob listener instancepublic FBBlob(GDSHelper c, long blobId, FBObjectListener.BlobListener blobListener, FBBlob.Config config)
c
- connection that will be used to access Blob.blobId
- ID of the Blob.blobListener
- blob listener instanceconfig
- blob configuration (null
allowed in Jaybird 5, will be disallowed in Jaybird 6)@Deprecated public FBBlob(GDSHelper c, long blobId)
FBBlob(GDSHelper, long, FBObjectListener.BlobListener, Config)
c
- connection that will be used to access Blob.blobId
- ID of the Blob.public void free() throws java.sql.SQLException
free
in interface java.sql.Blob
java.sql.SQLException
public java.io.InputStream getBinaryStream(long pos, long length) throws java.sql.SQLException
getBinaryStream
in interface java.sql.Blob
java.sql.SQLException
public byte[] getInfo(byte[] items, int buffer_length) throws java.sql.SQLException
items
- items in which we are interested.buffer_length
- buffer where information will be stored.java.sql.SQLException
- if something went wrong.public long length() throws java.sql.SQLException
length
in interface java.sql.Blob
java.sql.SQLException
public boolean isSegmented() throws java.sql.SQLException
FirebirdBlob
FirebirdBlob.BlobInputStream.seek(int)
method.isSegmented
in interface FirebirdBlob
true
if this blob is segmented, otherwise false
java.sql.SQLException
public FirebirdBlob detach() throws java.sql.SQLException
FirebirdBlob
Note, detached blob will not remember the stream position of this object. This means that you cannot start reading data from the blob, then detach it, and then continue reading. Reading from detached blob will begin at the blob start.
detach
in interface FirebirdBlob
FirebirdBlob
that is not under result set
control.java.sql.SQLException
- if Blob cannot be detached.public byte[] getBytes(long pos, int length) throws java.sql.SQLException
getBytes
in interface java.sql.Blob
java.sql.SQLException
public java.io.InputStream getBinaryStream() throws java.sql.SQLException
getBinaryStream
in interface java.sql.Blob
java.sql.SQLException
public long position(byte[] pattern, long start) throws java.sql.SQLException
position
in interface java.sql.Blob
java.sql.SQLException
public long position(java.sql.Blob pattern, long start) throws java.sql.SQLException
position
in interface java.sql.Blob
java.sql.SQLException
public void truncate(long len) throws java.sql.SQLException
truncate
in interface java.sql.Blob
java.sql.SQLException
public int setBytes(long pos, byte[] bytes) throws java.sql.SQLException
setBytes
in interface java.sql.Blob
java.sql.SQLException
public int setBytes(long pos, byte[] bytes, int offset, int len) throws java.sql.SQLException
setBytes
in interface java.sql.Blob
java.sql.SQLException
public java.io.OutputStream setBinaryStream(long pos) throws java.sql.SQLException
setBinaryStream
in interface java.sql.Blob
java.sql.SQLException
public long getBlobId() throws java.sql.SQLException
Blob
Blob
's identifierjava.sql.SQLException
- if a database access error occurspublic void copyBytes(byte[] bytes, int pos, int len) throws java.sql.SQLException
java.sql.SQLException
public void copyStream(java.io.InputStream inputStream, long length) throws java.sql.SQLException
InputStream
into this Blob.
Calling with length -1
is equivalent to calling copyStream(InputStream)
, and will copy
the whole stream.
inputStream
- the stream from which data will be copiedlength
- The maximum number of bytes to read from the InputStream, -1
to read whole streamjava.sql.SQLException
- if a database access error occurspublic void copyStream(java.io.InputStream inputStream) throws java.sql.SQLException
InputStream
into this Blob. Unlike
the copyStream(InputStream, long)
method, this one copies bytes
until the EOF is reached.inputStream
- the stream from which data will be copiedjava.sql.SQLException
- if a database access error occurspublic void copyCharacterStream(java.io.Reader reader, long length, Encoding encoding) throws java.sql.SQLException
Calling with length -1
is equivalent to calling copyCharacterStream(Reader, Encoding)
.
reader
- the source of data to copylength
- The maximum number of bytes to copy, or -1
to read the whole streamencoding
- The encoding used in the character streamjava.sql.SQLException
copyCharacterStream(Reader, long)
public void copyCharacterStream(java.io.Reader reader, long length) throws java.sql.SQLException
Calling with length -1
is equivalent to calling copyCharacterStream(Reader)
.
reader
- the source of data to copylength
- The maximum number of bytes to copy, or -1
to read the whole streamjava.sql.SQLException
public void copyCharacterStream(java.io.Reader reader, Encoding encoding) throws java.sql.SQLException
copyCharacterStream(Reader, long, Encoding)
method, this one copies bytes until the EOF is reached.reader
- the source of data to copyencoding
- The encoding used in the character streamjava.sql.SQLException
copyCharacterStream(Reader)
public void copyCharacterStream(java.io.Reader reader) throws java.sql.SQLException
copyCharacterStream(Reader, long)
method,
this one copies bytes until the EOF is reached. This method uses the encoding from the blob config (field
character set for subtype TEXT, if known, otherwise connection character set).reader
- the source of data to copyjava.sql.SQLException
public void transactionStateChanged(FbTransaction transaction, TransactionState newState, TransactionState previousState)
TransactionListener
transactionStateChanged
in interface TransactionListener
transaction
- FbTransaction
that changed state@InternalApi public static FBBlob.Config createConfig(FieldDescriptor fieldDescriptor, DatabaseConnectionProperties connectionProperties)
fieldDescriptor
- field descriptorconnectionProperties
- connection properties@InternalApi public static FBBlob.Config createConfig(int subType, DatabaseConnectionProperties connectionProperties, DatatypeCoder datatypeCoder)
subType
- blob subtype (e.g. ISCConstants.BLOB_SUB_TYPE_BINARY
or ISCConstants.BLOB_SUB_TYPE_TEXT
)connectionProperties
- connection propertiesdatatypeCoder
- data type coder for the connection character set@InternalApi public static FBBlob.Config createConfig(int subType, boolean useStreamBlob, int blobBufferSize, DatatypeCoder datatypeCoder)
subType
- blob subtype (e.g. ISCConstants.BLOB_SUB_TYPE_BINARY
or ISCConstants.BLOB_SUB_TYPE_TEXT
)useStreamBlob
- true
use stream blob, false
use segmented blobblobBufferSize
- blob buffer sizedatatypeCoder
- data type coder for the connection character setCopyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.