public class FBBlob extends Object implements FirebirdBlob, Synchronizable
Blob
.FirebirdBlob.BlobInputStream, FirebirdBlob.BlobOutputStream
Modifier and Type | Field and Description |
---|---|
static boolean |
SEGMENTED |
Constructor and Description |
---|
FBBlob(GDSHelper c)
Create new Blob instance.
|
FBBlob(GDSHelper c,
FBObjectListener.BlobListener blobListener)
Create new Blob instance.
|
FBBlob(GDSHelper c,
long blob_id)
Create instance of this class to access existing Blob.
|
FBBlob(GDSHelper c,
long blob_id,
FBObjectListener.BlobListener blobListener)
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(Reader reader,
Encoding encoding)
Copy data from a character stream into this Blob.
|
void |
copyCharacterStream(Reader reader,
long length,
Encoding encoding)
Copy data from a character stream into this Blob.
|
void |
copyStream(InputStream inputStream)
Copy the contents of an
InputStream into this Blob. |
void |
copyStream(InputStream inputStream,
long length)
Copy the contents of an
InputStream into this Blob. |
FirebirdBlob |
detach()
Detach this blob.
|
void |
free() |
InputStream |
getBinaryStream() |
InputStream |
getBinaryStream(long pos,
long length) |
long |
getBlobId()
Get the identifier for this
Blob |
byte[] |
getBytes(long pos,
int length) |
GDSHelper |
getGdsHelper() |
byte[] |
getInfo(byte[] items,
int buffer_length)
Get information about this Blob.
|
Object |
getSynchronizationObject()
Get synchronization object.
|
boolean |
isSegmented()
Check if blob is segmented.
|
long |
length() |
long |
position(Blob pattern,
long start) |
long |
position(byte[] pattern,
long start) |
OutputStream |
setBinaryStream(long pos) |
int |
setBytes(long pos,
byte[] bytes) |
int |
setBytes(long pos,
byte[] bytes,
int offset,
int len) |
void |
truncate(long len) |
public static final boolean SEGMENTED
public FBBlob(GDSHelper c, FBObjectListener.BlobListener blobListener)
c
- connection that will be used to write data to blobblobListener
- Blob listener instancepublic FBBlob(GDSHelper c)
c
- connection that will be used to write data to blob.public FBBlob(GDSHelper c, long blob_id, FBObjectListener.BlobListener blobListener)
c
- connection that will be used to access Blob.blob_id
- ID of the Blob.blobListener
- Blob listener instancepublic FBBlob(GDSHelper c, long blob_id)
c
- connection that will be used to access Blob.blob_id
- ID of the Blob.public final Object getSynchronizationObject()
Synchronizable
getSynchronizationObject
in interface Synchronizable
null
.public void free() throws SQLException
free
in interface Blob
SQLException
public InputStream getBinaryStream(long pos, long length) throws SQLException
getBinaryStream
in interface Blob
SQLException
public byte[] getInfo(byte[] items, int buffer_length) throws SQLException
items
- items in which we are interested.buffer_length
- buffer where information will be stored.SQLException
- if something went wrong.public long length() throws SQLException
length
in interface Blob
SQLException
public boolean isSegmented() throws SQLException
FirebirdBlob
FirebirdBlob.BlobInputStream.seek(int)
method.isSegmented
in interface FirebirdBlob
true
if this blob is segmented,
otherwise false
SQLException
public FirebirdBlob detach() throws 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.SQLException
- if Blob cannot be detached.public byte[] getBytes(long pos, int length) throws SQLException
getBytes
in interface Blob
SQLException
public InputStream getBinaryStream() throws SQLException
getBinaryStream
in interface Blob
SQLException
public long position(byte[] pattern, long start) throws SQLException
position
in interface Blob
SQLException
public long position(Blob pattern, long start) throws SQLException
position
in interface Blob
SQLException
public void truncate(long len) throws SQLException
truncate
in interface Blob
SQLException
public int setBytes(long pos, byte[] bytes) throws SQLException
setBytes
in interface Blob
SQLException
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException
setBytes
in interface Blob
SQLException
public OutputStream setBinaryStream(long pos) throws SQLException
setBinaryStream
in interface Blob
SQLException
public long getBlobId() throws SQLException
Blob
Blob
's identifierSQLException
- if a database access error occurspublic void copyBytes(byte[] bytes, int pos, int len) throws SQLException
SQLException
public GDSHelper getGdsHelper()
public void copyStream(InputStream inputStream, long length) throws 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 streamSQLException
- if a database access error occurspublic void copyStream(InputStream inputStream) throws 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 copiedSQLException
- if a database access error occurspublic void copyCharacterStream(Reader reader, long length, Encoding encoding) throws 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 streamSQLException
public void copyCharacterStream(Reader reader, Encoding encoding) throws 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 streamSQLException
Copyright © 2001-2019 Jaybird (Firebird JDBC/JCA) team. All rights reserved.