Class REDBlockIterator

  • All Implemented Interfaces:
    Iterator<REDBlock>

    public class REDBlockIterator
    extends Object
    implements Iterator<REDBlock>
    An Iterator that iterates RED blocks (primary and non-primary).
    Author:
    George Politis
    • Constructor Detail

      • REDBlockIterator

        public REDBlockIterator​(byte[] buffer,
                                int offset,
                                int length)
        Ctor.
        Parameters:
        buffer - the byte buffer that contains the RED payload.
        offset - the offset in the buffer where the RED payload begins.
        length - the length of the RED payload.
    • Method Detail

      • matchFirst

        public static REDBlock matchFirst​(Predicate<REDBlock> predicate,
                                          byte[] buffer,
                                          int offset,
                                          int length)
        Matches a RED block in the RED payload.
        Parameters:
        predicate - the predicate that is used to match the RED block.
        buffer - the byte buffer that contains the RED payload.
        offset - the offset in the buffer where the RED payload begins.
        length - the length of the RED payload.
        Returns:
        the first RED block that matches the given predicate, null otherwise.
      • getPrimaryBlock

        public static REDBlock getPrimaryBlock​(byte[] buffer,
                                               int offset,
                                               int length)
        Gets the first RED block in the RED payload.
        Parameters:
        buffer - the byte buffer that contains the RED payload.
        offset - the offset in the buffer where the RED payload begins.
        length - the length of the RED payload.
        Returns:
        the primary RED block if it exists, null otherwise.
      • isMultiBlock

        public static boolean isMultiBlock​(byte[] buffer,
                                           int offset,
                                           int length)
        Returns true if a specific RED packet contains multiple blocks; false, otherwise.
        Parameters:
        buffer - the byte buffer that contains the RED payload.
        offset - the offset in the buffer where the RED payload begins.
        length - the length of the RED payload.
        Returns:
        true if pkt contains multiple RED blocks; otherwise, false