Package org.apache.bookkeeper.streaming
Class LedgerOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.bookkeeper.streaming.LedgerOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class LedgerOutputStream extends java.io.OutputStreamthis 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
Fields Modifier and Type Field Description (package private) byte[]bbytes(package private) intdefaultSize
-
Constructor Summary
Constructors Constructor Description LedgerOutputStream(LedgerHandle lh)construct a outputstream from a ledger handle.LedgerOutputStream(LedgerHandle lh, int size)construct a outputstream from a ledger handle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
LedgerOutputStream
public LedgerOutputStream(LedgerHandle lh)
construct a outputstream from a ledger handle.- Parameters:
lh- ledger handle
-
LedgerOutputStream
public LedgerOutputStream(LedgerHandle lh, int size)
construct a outputstream from a ledger handle.- Parameters:
lh- the ledger handlesize- the size of the buffer
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream
-
flush
public void flush()
- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream
-
write
public void write(byte[] b)
- Overrides:
writein classjava.io.OutputStream
-
write
public void write(byte[] b, int off, int len)- Overrides:
writein classjava.io.OutputStream
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
-