Class CloseableIteratorBufferAsInputStream
java.lang.Object
java.io.InputStream
io.servicetalk.concurrent.internal.AbstractCloseableIteratorAsInputStream<Buffer>
io.servicetalk.concurrent.api.internal.CloseableIteratorBufferAsInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class CloseableIteratorBufferAsInputStream
extends AbstractCloseableIteratorAsInputStream<Buffer>
-
Constructor Summary
ConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected boolean
Determine if there are left over bytes buffered.protected boolean
isClosed()
Determine ifAbstractCloseableIteratorAsInputStream.close()
has been called.protected void
Check if the left over buffer needs to be reset.protected int
Get the number of readable bytes in the left over buffer.protected void
leftOverReadBytes
(byte[] dst, int offset, int length) Read bytes from the left over buffer intob
.protected byte
Read a single byte from the left over buffer.protected void
Reset the left over buffer.protected void
nextLeftOver
(CloseableIterator<Buffer> iterator) Read the next element from theIterator
.Methods inherited from class io.servicetalk.concurrent.internal.AbstractCloseableIteratorAsInputStream
available, markSupported, read, read
Methods inherited from class java.io.InputStream
mark, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
CloseableIteratorBufferAsInputStream
Create a new instance.- Parameters:
iterator
- TheCloseableIterator
providing data.
-
-
Method Details
-
leftOverReadableBytes
protected int leftOverReadableBytes()Description copied from class:AbstractCloseableIteratorAsInputStream
Get the number of readable bytes in the left over buffer.- Specified by:
leftOverReadableBytes
in classAbstractCloseableIteratorAsInputStream<Buffer>
- Returns:
- the number of readable bytes in the left over buffer.
-
leftOverReadBytes
protected void leftOverReadBytes(byte[] dst, int offset, int length) Description copied from class:AbstractCloseableIteratorAsInputStream
Read bytes from the left over buffer intob
.- Specified by:
leftOverReadBytes
in classAbstractCloseableIteratorAsInputStream<Buffer>
- Parameters:
dst
- The destination to read to.offset
- The offset to read into fordst
.length
- The amount of bytes to read from the left over buffer.
-
hasLeftOver
protected boolean hasLeftOver()Description copied from class:AbstractCloseableIteratorAsInputStream
Determine if there are left over bytes buffered.- Specified by:
hasLeftOver
in classAbstractCloseableIteratorAsInputStream<Buffer>
- Returns:
true
if there are left over bytes buffered.
-
leftOverCheckReset
protected void leftOverCheckReset()Description copied from class:AbstractCloseableIteratorAsInputStream
Check if the left over buffer needs to be reset.- Specified by:
leftOverCheckReset
in classAbstractCloseableIteratorAsInputStream<Buffer>
-
leftOverReset
protected void leftOverReset()Description copied from class:AbstractCloseableIteratorAsInputStream
Reset the left over buffer.- Specified by:
leftOverReset
in classAbstractCloseableIteratorAsInputStream<Buffer>
-
nextLeftOver
Description copied from class:AbstractCloseableIteratorAsInputStream
Read the next element from theIterator
.- Specified by:
nextLeftOver
in classAbstractCloseableIteratorAsInputStream<Buffer>
- Parameters:
iterator
- TheCloseableIterator
to get the next element from.
-
leftOverReadSingleByte
protected byte leftOverReadSingleByte()Description copied from class:AbstractCloseableIteratorAsInputStream
Read a single byte from the left over buffer.- Specified by:
leftOverReadSingleByte
in classAbstractCloseableIteratorAsInputStream<Buffer>
- Returns:
- a single byte from the left over buffer.
-
isClosed
protected boolean isClosed()Description copied from class:AbstractCloseableIteratorAsInputStream
Determine ifAbstractCloseableIteratorAsInputStream.close()
has been called.- Specified by:
isClosed
in classAbstractCloseableIteratorAsInputStream<Buffer>
- Returns:
true
ifAbstractCloseableIteratorAsInputStream.close()
has been called.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classAbstractCloseableIteratorAsInputStream<Buffer>
- Throws:
IOException
-