Package org.apache.bookkeeper.streaming
Class LedgerInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.bookkeeper.streaming.LedgerInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class LedgerInputStream extends java.io.InputStream
An input stream on reading data from a ledger.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) byte[]
bbytes
(package private) int
defaultSize
(package private) int
increment
(package private) long
lastEntry
(package private) java.util.Enumeration<LedgerEntry>
ledgerSeq
-
Constructor Summary
Constructors Constructor Description LedgerInputStream(LedgerHandle lh)
construct a outputstream from a ledger handle.LedgerInputStream(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()
Method close currently doesn't do anything.int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
-
-
-
Field Detail
-
bbytes
byte[] bbytes
-
lastEntry
long lastEntry
-
increment
int increment
-
defaultSize
int defaultSize
-
ledgerSeq
java.util.Enumeration<LedgerEntry> ledgerSeq
-
-
Constructor Detail
-
LedgerInputStream
public LedgerInputStream(LedgerHandle lh) throws BKException, java.lang.InterruptedException
construct a outputstream from a ledger handle.- Parameters:
lh
- ledger handle- Throws:
BKException
- when encountered bookkeeper exceptionsjava.lang.InterruptedException
- when opening a ledger input stream is interrupted.
-
LedgerInputStream
public LedgerInputStream(LedgerHandle lh, int size) throws BKException, java.lang.InterruptedException
construct a outputstream from a ledger handle.- Parameters:
lh
- the ledger handlesize
- the size of the buffer- Throws:
BKException
- when encountered bookkeeper exceptionsjava.lang.InterruptedException
- when opening a ledger input stream is interrupted.
-
-
Method Detail
-
close
public void close()
Method close currently doesn't do anything. The application is supposed to open and close the ledger handle backing up a stream (LedgerHandle
).- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-