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.OutputStream
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
Fields Modifier and Type Field Description (package private) byte[]
bbytes
(package private) int
defaultSize
-
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 void
close()
void
flush()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
-
flush
public void flush()
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
-
write
public void write(byte[] b)
- Overrides:
write
in classjava.io.OutputStream
-
write
public void write(byte[] b, int off, int len)
- Overrides:
write
in classjava.io.OutputStream
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
-