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

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Functional interface for defining standard or commonly used consumers of the bytes provided by a ProtonBufferIterator.
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
     
    boolean
    Called to check if more bytes are available from this iterator.
    byte
    Fetch the next byte from the buffer iterator.
    int
    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

      default int forEach(ProtonBufferIterator.ByteConsumer consumer)
      Parameters:
      consumer - The consumer of the iterated bytes.
      Returns:
      the number of bytes that were iterated or -1 if iteration ended early.