Class AbstractByteSequence.AggregateByteSequence

  • All Implemented Interfaces:
    ByteSequence
    Enclosing class:
    AbstractByteSequence

    public static class AbstractByteSequence.AggregateByteSequence
    extends AbstractByteSequence
    A naive ByteSequence that glues two ByteSequence instances together.
    Since:
    Coherence 3.7
    Author:
    cp 2010-06-29
    • Constructor Detail

      • AggregateByteSequence

        public AggregateByteSequence​(ByteSequence seqFirst,
                                     ByteSequence seqSecond)
        Construct an AggregateByteSequence from two ByteSequence objects.
        Parameters:
        seqFirst - the first ByteSequence
        seqSecond - the second ByteSequence
    • Method Detail

      • length

        public int length()
        Determine the number of bytes of data represented by this ByteSequence.
        Returns:
        the number of bytes represented by this Node
      • byteAt

        public byte byteAt​(int of)
        Determine the n-th byte of the byte sequence.
        Parameters:
        of - the zero-based byte offset within the sequence of bytes (0 <= of < ByteSequence.length())
        Returns:
        the byte at the specified offset
      • subSequence

        public ByteSequence subSequence​(int ofStart,
                                        int ofEnd)
        Returns a new ByteSequence that is a subsequence of this sequence. The subsequence starts with the byte value at the specified index and ends with the byte value at index ofEnd - 1. The length (in bytes) of the returned sequence is ofEnd - ofStart, so if ofStart == ofEnd then an empty sequence is returned.
        Specified by:
        subSequence in interface ByteSequence
        Overrides:
        subSequence in class AbstractByteSequence
        Parameters:
        ofStart - the start index, inclusive
        ofEnd - the end index, exclusive
        Returns:
        the specified subsequence