Package org.apache.bookkeeper.streaming
Class LedgerOutputStream
java.lang.Object
java.io.OutputStream
org.apache.bookkeeper.streaming.LedgerOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
this class provides a streaming api to get an output stream from a ledger
handle and write to it as a stream of bytes. This is built on top of
ledgerhandle api and uses a buffer to cache the data written to it and writes
out the entry to the ledger.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) byte[](package private) int -
Constructor Summary
ConstructorsConstructorDescriptionconstruct a outputstream from a ledger handle.LedgerOutputStream(LedgerHandle lh, int size) construct a outputstream from a ledger handle. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
bbytes
byte[] bbytes -
defaultSize
int defaultSize
-
-
Constructor Details
-
LedgerOutputStream
construct a outputstream from a ledger handle.- Parameters:
lh- ledger handle
-
LedgerOutputStream
construct a outputstream from a ledger handle.- Parameters:
lh- the ledger handlesize- the size of the buffer
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
flush
public void flush()- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
write
public void write(byte[] b) - Overrides:
writein classOutputStream
-
write
public void write(byte[] b, int off, int len) - Overrides:
writein classOutputStream
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-