Package org.postgresql.largeobject
Class BlobOutputStream
java.lang.Object
java.io.OutputStream
org.postgresql.largeobject.BlobOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
This implements a basic output stream that writes to a LargeObject.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intPosition within the buffer.private intSize of the buffer (default 1K).private byte[]Buffer.private LargeObjectThe parent LargeObject. -
Constructor Summary
ConstructorsConstructorDescriptionCreate an OutputStream to a large object.BlobOutputStream(LargeObject lo, int bsize) Create an OutputStream to a large object. -
Method Summary
Modifier and TypeMethodDescriptionprivate LargeObjectvoidclose()voidflush()Flushes this output stream and forces any buffered output bytes to be written out.voidwrite(byte[] buf, int off, int len) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
lo
The parent LargeObject. -
buf
private byte[] bufBuffer. -
bsize
private int bsizeSize of the buffer (default 1K). -
bpos
private int bposPosition within the buffer.
-
-
Constructor Details
-
BlobOutputStream
Create an OutputStream to a large object.- Parameters:
lo- LargeObject
-
BlobOutputStream
Create an OutputStream to a large object.- Parameters:
lo- LargeObjectbsize- The size of the buffer used to improve performance
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
Flushes this output stream and forces any buffered output bytes to be written out. The general contract offlushis that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- if an I/O error occurs.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
checkClosed
- Throws:
IOException
-