java.lang.Object
java.io.OutputStream
org.firebirdsql.jdbc.FBBlobOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,FirebirdBlob.BlobOutputStream
@InternalApi
public final class FBBlobOutputStream
extends OutputStream
implements FirebirdBlob.BlobOutputStream
OutputStream
for writing Firebird blobs.
This class is internal API of Jaybird. Future versions may radically change, move, or make inaccessible this type.
For the public API, refer to the FirebirdBlob.BlobOutputStream
interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this stream.void
flush()
getBlob()
Get instance ofFirebirdBlob
to which this stream belongs to.long
length()
Get Blob length.void
write
(byte[] b, int off, int len) Write data from the buffer into this stream.void
write
(int b) Write single byte into the stream.Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Method Details
-
getBlob
Description copied from interface:FirebirdBlob.BlobOutputStream
Get instance ofFirebirdBlob
to which this stream belongs to.Note, code
FirebirdBlob.BlobOutputStream otherStream = (FirebirdBlob.BlobOutputStream) inputStream.getBlob().setBinaryStream(1);
will return new stream object.- Specified by:
getBlob
in interfaceFirebirdBlob.BlobOutputStream
- Returns:
- instance of
FirebirdBlob
.
-
length
Description copied from interface:FirebirdBlob.BlobOutputStream
Get Blob length. This method is the only available way to obtain length of a Blob that is in temporary state,- Specified by:
length
in interfaceFirebirdBlob.BlobOutputStream
- Returns:
- length of the blob.
- Throws:
IOException
- if I/O error occurs.
-
write
Write single byte into the stream.Writes are buffered up to the buffer length of the blob (optionally specified by the connection property
blobBufferSize
).- Specified by:
write
in interfaceFirebirdBlob.BlobOutputStream
- Specified by:
write
in classOutputStream
- Parameters:
b
- data to write, only lowest 8 bits are written.- Throws:
IOException
- if I/O error occurs.
-
write
Write data from the buffer into this stream.Writes are buffered up to the buffer length of the blob (optionally specified by the connection property
blobBufferSize
).- Specified by:
write
in interfaceFirebirdBlob.BlobOutputStream
- Overrides:
write
in classOutputStream
- Parameters:
b
- buffer from which data should be written.off
- offset in the buffer.len
- number of bytes to write.- Throws:
IOException
- if I/O error occurs.
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
Description copied from interface:FirebirdBlob.BlobOutputStream
Close this stream. Calling this method closes Blob stream and moves Blob from temporary into permanent state making any further content updates impossible.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceFirebirdBlob.BlobOutputStream
- Overrides:
close
in classOutputStream
- Throws:
IOException
- if I/O error occurs.
-