Package org.apache.qpid.protonj2.buffer
Interface ProtonBufferIterator
public interface ProtonBufferIterator
An
Iterator
like API for accessing the underlying bytes of the
target buffer one at a time.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Functional interface for defining standard or commonly used consumers of the bytes provided by aProtonBufferIterator
. -
Method Summary
Modifier and TypeMethodDescriptiondefault int
forEach
(ProtonBufferIterator.ByteConsumer consumer) boolean
hasNext()
Called to check if more bytes are available from this iterator.byte
next()
Fetch the next byte from the buffer iterator.int
offset()
Returns the current offset into the buffer from where iteration started.int
-
Method Details
-
hasNext
boolean hasNext()Called to check if more bytes are available from this iterator.- Returns:
- true if there is another byte available or false if at the end of the buffer.
-
next
byte next()Fetch the next byte from the buffer iterator.- Returns:
- the next available byte from the buffer iterator.
- Throws:
NoSuchElementException
- if there is no next byte available.
-
remaining
int remaining()- Returns:
- the number of remaining bytes that can be read from this iterator.
-
offset
int offset()Returns the current offset into the buffer from where iteration started.- Returns:
- the current offset into the buffer from where iteration started.
-
forEach
- Parameters:
consumer
- The consumer of the iterated bytes.- Returns:
- the number of bytes that were iterated or -1 if iteration ended early.
-