T
- Type of items emitted by the CloseableIterator
.public abstract class AbstractCloseableIteratorAsInputStream<T>
extends java.io.InputStream
Modifier | Constructor and Description |
---|---|
protected |
AbstractCloseableIteratorAsInputStream(CloseableIterator<T> source)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
protected abstract boolean |
hasLeftOver()
Determine if there are left over bytes buffered.
|
protected abstract boolean |
isClosed()
Determine if
close() has been called. |
protected abstract void |
leftOverCheckReset()
Check if the left over buffer needs to be reset.
|
protected abstract int |
leftOverReadableBytes()
Get the number of readable bytes in the left over buffer.
|
protected abstract void |
leftOverReadBytes(byte[] dst,
int offset,
int length)
Read bytes from the left over buffer into
b . |
protected abstract byte |
leftOverReadSingleByte()
Read a single byte from the left over buffer.
|
protected abstract void |
leftOverReset()
Reset the left over buffer.
|
boolean |
markSupported() |
protected abstract void |
nextLeftOver(CloseableIterator<T> iterator)
Read the next element from the
Iterator . |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
protected AbstractCloseableIteratorAsInputStream(CloseableIterator<T> source)
source
- The CloseableIterator
providing data.protected abstract int leftOverReadableBytes()
protected abstract void leftOverReadBytes(byte[] dst, int offset, int length)
b
.dst
- The destination to read to.offset
- The offset to read into for dst
.length
- The amount of bytes to read from the left over buffer.protected abstract boolean hasLeftOver()
true
if there are left over bytes buffered.protected abstract void leftOverCheckReset()
protected abstract void leftOverReset()
protected abstract void nextLeftOver(CloseableIterator<T> iterator)
Iterator
.iterator
- The CloseableIterator
to get the next element from.protected abstract byte leftOverReadSingleByte()
protected abstract boolean isClosed()
close()
has been called.true
if close()
has been called.public final int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public final int available()
available
in class java.io.InputStream
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public final boolean markSupported()
markSupported
in class java.io.InputStream
public final int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException