Interface Sequence

  • All Superinterfaces:
    org.refcodes.mixin.Clearable, org.refcodes.mixin.InputStreamAccessor, Iterable<Byte>, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.OutputStreamAccessor
    All Known Implementing Classes:
    BoundedSequenceDecorator, ChunkSequence

    public interface Sequence
    extends org.refcodes.mixin.LengthAccessor, Iterable<Byte>, org.refcodes.mixin.InputStreamAccessor, org.refcodes.mixin.OutputStreamAccessor, org.refcodes.mixin.Clearable
    A Sequence abstracts a byte field providing means to applying complex operations on that byte field.
    • Method Detail

      • append

        default void append​(byte... aBytes)
        Appends the given bytes to the end of this Sequence. Beware: This Sequence is modified! If you do not wish to modify this Sequence, please use toAppend(byte...).
        Parameters:
        aBytes - The bytes to be appended.
      • append

        void append​(byte[] aBytes,
                    int aOffset,
                    int aLength)
        Appends the given bytes to the end of this Sequence. Beware: This Sequence is modified! If you do not wish to modify this Sequence, please use toAppend(byte[], int, int).
        Parameters:
        aBytes - The bytes to be appended.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be appended.
      • clear

        default void clear()
        Sets all bytes in the Sequence to zero.
        Specified by:
        clear in interface org.refcodes.mixin.Clearable
      • clear

        default void clear​(byte aValue)
        Sets all bytes in the Sequence to the provided value.
        Parameters:
        aValue - The value with which to zero out this Sequence.
      • concatenate

        default void concatenate​(org.refcodes.mixin.ConcatenateMode aConcatenateMode,
                                 byte... aBytes)
        Concatenates the given bytes with this Sequence according to the provided ConcatenateMode . Beware: This Sequence is modified! If you do not wish to modify this Sequence, please use toConcatenate(ConcatenateMode, byte...).
        Parameters:
        aConcatenateMode - The concatenation mode to be used.
        aBytes - The bytes to be concatenated with.
      • concatenate

        default void concatenate​(org.refcodes.mixin.ConcatenateMode aConcatenateMode,
                                 byte[] aBytes,
                                 int aOffset,
                                 int aLength)
        Concatenates the given bytes with this Sequence according to the provided ConcatenateMode . Beware: This Sequence is modified! If you do not wish to modify this Sequence, please use toConcatenate(ConcatenateMode, byte[], int, int).
        Parameters:
        aConcatenateMode - The concatenation mode to be used.
        aBytes - The bytes to be concatenated with.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be concatenated.
      • concatenate

        default void concatenate​(Sequence aSequence,
                                 org.refcodes.mixin.ConcatenateMode aConcatenateMode)
        Concatenates the given Sequence with this Sequence according to the provided ConcatenateMode . Beware: This Sequence is modified! If you do not wish to modify this Sequence, please use toConcatenate(Sequence, ConcatenateMode).
        Parameters:
        aSequence - The Sequence to be concatenated with.
        aConcatenateMode - The concatenation mode to be used.
      • empty

        void empty()
        Empties the Sequence to end up being of length 0.
      • getByteAt

        byte getByteAt​(int aIndex)
                throws IndexOutOfBoundsException
        Returns the byte at the given index in the Sequence.
        Parameters:
        aIndex - The index of the byte to retrieve.
        Returns:
        The byte being retrieved.
        Throws:
        IndexOutOfBoundsException - thrown in case the given index is out of bounds.
      • getInputStream

        default InputStream getInputStream()
        Creates an InputStream backed by this Sequence.
        Specified by:
        getInputStream in interface org.refcodes.mixin.InputStreamAccessor
      • getOutputStream

        default OutputStream getOutputStream()
        Creates an OutputStream backed by this Sequence.
        Specified by:
        getOutputStream in interface org.refcodes.mixin.OutputStreamAccessor
      • overwrite

        default void overwrite​(byte[] aBytes)
        Writes the given bytes into this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
      • overwrite

        default void overwrite​(byte[] aBytes,
                               int aLength)
        Writes the given bytes into this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        aLength - The number of bytes to be copied starting at offset 0.
      • overwrite

        default void overwrite​(int aOffset,
                               byte[] aBytes)
        Writes the given bytes into this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aBytes - The byte array where to copy the bytes from.
      • overwrite

        default void overwrite​(int aOffset,
                               byte[] aBytes,
                               int aBytesOffset,
                               int aLength)
        Writes the given bytes into this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aBytes - The byte array where to copy the bytes from.
        aBytesOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
      • overwrite

        default void overwrite​(int aOffset,
                               Sequence aSequence)
        Writes the given Sequence into this Sequence. If the Sequence is too small for the given Sequence's bytes to fit into, then this Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the given Sequence's bytes to.
        aSequence - The given Sequence where to copy the bytes from.
      • overwrite

        default void overwrite​(int aOffset,
                               Sequence aSequence,
                               int aSequenceOffset,
                               int aLength)
        Writes the given bytes into this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aSequence - The given Sequence where to copy the bytes from.
        aSequenceOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
      • overwrite

        default void overwrite​(Sequence aSequence)
        Writes the given Sequence into this Sequence. If the Sequence is too small for the given Sequence's bytes to fit into, then this Sequence is extended accordingly.
        Parameters:
        aSequence - The given Sequence where to copy the bytes from.
      • overwrite

        default void overwrite​(Sequence aSequence,
                               int aLength)
        Writes the given bytes into this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aSequence - The Sequence where to copy the bytes from.
        aLength - The number of bytes to be copied starting at offset 0.
      • prepend

        default void prepend​(byte... aBytes)
        Prepends the given bytes the beginning of this Sequence. Beware: This Sequence is modified! If you do not wish to modify this Sequence, please use toPrepend(byte...).
        Parameters:
        aBytes - The bytes to be prepended.
      • prepend

        void prepend​(byte[] aBytes,
                     int aOffset,
                     int aLength)
        Prepends the given bytes to the beginning of this Sequence. Beware: This Sequence is modified! If you do not wish to modify this Sequence, please use toPrepend(byte[], int, int).
        Parameters:
        aBytes - The bytes to be prepended.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be prepended.
      • replace

        default void replace​(byte[] aBytes)
        Replaces the given bytes with this byte array.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
      • replace

        default void replace​(byte[] aBytes,
                             int aLength)
        Replaces the given bytes with this byte array.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        aLength - The number of bytes to be copied starting with offset 0.
      • replace

        void replace​(byte[] aBytes,
                     int aOffset,
                     int aLength)
        Replaces the given bytes with this byte array.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        aOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
      • replace

        default void replace​(Sequence aSequence)
        Replaces the given Sequence into this Sequence.
        Parameters:
        aSequence - The given Sequence where to copy the bytes from.
      • replace

        default void replace​(Sequence aSequence,
                             int aLength)
        Replaces the given bytes with this Sequence.
        Parameters:
        aSequence - The given Sequence where to copy the bytes from.
        aLength - The number of bytes to be copied starting with offset 0.
      • replace

        void replace​(Sequence aSequence,
                     int aOffset,
                     int aLength)
        Replaces the given bytes with this Sequence.
        Parameters:
        aSequence - The given Sequence where to copy the bytes from.
        aOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
      • setByteAt

        void setByteAt​(int aIndex,
                       byte aByte)
        Sets the byte at the given index in the Sequence.
        Parameters:
        aIndex - The index of the byte to set.
        aByte - The byte to set at the given index.
        Throws:
        IndexOutOfBoundsException - thrown in case the given index is out of bounds.
      • toAppend

        default Sequence toAppend​(byte... aBytes)
        Appends the given bytes to the end of this Sequence. This Sequence is not modified and a new Sequence is returned.
        Parameters:
        aBytes - The bytes to be appended.
        Returns:
        The according Sequence.
      • toAppend

        Sequence toAppend​(byte[] aBytes,
                          int aOffset,
                          int aLength)
        Appends the given bytes to the end of this Sequence. This Sequence is not modified and a new Sequence is returned.
        Parameters:
        aBytes - The bytes to be appended.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be appended.
        Returns:
        The according Sequence.
      • toBytes

        default byte[] toBytes()
        Retrieves a continuous array of bytes from the Sequence.
        Returns:
        The according byte array.
      • toBytes

        default byte[] toBytes​(int aOffset,
                               int aLength)
        Retrieves a continuous array of bytes from the Sequence, starting with the byte at the given offset and containing the given number of bytes.
        Parameters:
        aOffset - The offset from where to start collecting the bytes.
        aLength - The length of the byte array to be returned.
        Returns:
        The according bytes.
        Throws:
        IndexOutOfBoundsException - thrown in case the length overshot the available bytes.
      • toBytes

        default void toBytes​(int aOffset,
                             int aLength,
                             byte[] aBytes,
                             int aBytesOffset)
        Retrieves a continuous array of bytes from the Sequence, starting with the byte at the given offset and containing the given number of bytes. The bytes are stored in the provided bytes starting at the given bytes' offset.
        Parameters:
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be copied.
        aBytes - The byte array where to copy the bytes to.
        aBytesOffset - The offset in the byte array where to start copying.
      • toClone

        Sequence toClone()
        Creates a deep clone of this Sequence.
        Returns:
        The deep clone.
      • toConcatenate

        default Sequence toConcatenate​(org.refcodes.mixin.ConcatenateMode aConcatenateMode,
                                       byte... aBytes)
        Concatenates the given bytes with this Sequence according to the provided ConcatenateMode. This Sequence is not modified and a new Sequence is returned.
        Parameters:
        aConcatenateMode - The concatenation mode to be used.
        aBytes - The bytes to be concatenated with.
        Returns:
        The according Sequence.
      • toConcatenate

        default Sequence toConcatenate​(org.refcodes.mixin.ConcatenateMode aConcatenateMode,
                                       byte[] aBytes,
                                       int aOffset,
                                       int aLength)
        Concatenates the given bytes with this Sequence according to the provided ConcatenateMode. This Sequence is not modified and a new Sequence is returned.
        Parameters:
        aConcatenateMode - The concatenation mode to be used.
        aBytes - The bytes to be concatenated.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be concatenated with.
        Returns:
        The according Sequence.
      • toConcatenate

        default Sequence toConcatenate​(Sequence aSequence,
                                       org.refcodes.mixin.ConcatenateMode aConcatenateMode)
        Concatenates the given Sequence with this Sequence according to the provided ConcatenateMode. This Sequence is not modified and a new Sequence is returned.
        Parameters:
        aSequence - The Sequence to be concatenated with.
        aConcatenateMode - The concatenation mode to be used.
        Returns:
        The according Sequence.
      • toCrcBytes

        byte[] toCrcBytes​(org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                          org.refcodes.numerical.Endianess aEndianess)
        Calculates the CRC checksum as byte array for this Sequence.
        Parameters:
        aCrcAlgorithm - The CrcAlgorithm to be used when calculating the CRC checksum.
        aEndianess - The Endianess (little endian or big endian) to be used for the byte array representation of the CRC checksum.
        Returns:
        The CRC checksum of the Sequence.
      • toCrcBytes

        byte[] toCrcBytes​(long aCrcChecksum,
                          org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                          org.refcodes.numerical.Endianess aEndianess)
        Calculates the CRC checksum as byte array for this Sequence.
        Parameters:
        aCrcChecksum - The CRC checksum from which to continue calculating the checksum,
        aCrcAlgorithm - The CrcAlgorithm to be used when calculating the CRC checksum.
        aEndianess - The Endianess (little endian or big endian) to be used for the byte array representation of the CRC checksum.
        Returns:
        The CRC checksum of the Sequence.
      • toCrcChecksum

        long toCrcChecksum​(org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm)
        Calculates the CRC checksum for this Sequence.
        Parameters:
        aCrcAlgorithm - The CrcAlgorithm to be used when calculating the CRC checksum.
        Returns:
        The CRC checksum of the Sequence.
      • toCrcChecksum

        long toCrcChecksum​(long aCrcChecksum,
                           org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm)
        Calculates the CRC checksum for this Sequence.
        Parameters:
        aCrcChecksum - The CRC checksum from which to continue calculating the checksum,
        aCrcAlgorithm - The CrcAlgorithm to be used when calculating the CRC checksum.
        Returns:
        The CRC checksum of the Sequence.
      • toHexString

        default String toHexString()
        Converts this Sequence to a hexadecimal String representation.
        Returns:
        The according String.
      • toHexString

        default String toHexString​(String aSeparator)
        Converts this Sequence to a hexadecimal String representation.
        Parameters:
        aSeparator - The separator to separate two hex bytes from each other or null if no separator is to be used.
        Returns:
        The according String.
      • toOverwrite

        default Sequence toOverwrite​(byte[] aBytes)
        Writes the given bytes into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        Returns:
        The according Sequence.
      • toOverwrite

        default Sequence toOverwrite​(byte[] aBytes,
                                     int aLength)
        Writes the given bytes into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        aLength - The number of bytes to be copied starting with offset 0.
        Returns:
        The according Sequence.
      • toOverwrite

        default Sequence toOverwrite​(int aOffset,
                                     byte[] aBytes)
        Writes the given bytes into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aBytes - The byte array where to copy the bytes from.
        Returns:
        The according Sequence.
      • toOverwrite

        Sequence toOverwrite​(int aOffset,
                             byte[] aBytes,
                             int aBytesOffset,
                             int aLength)
        Writes the given bytes into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aBytes - The byte array where to copy the bytes from.
        aBytesOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
        Returns:
        The according Sequence.
      • toOverwrite

        default Sequence toOverwrite​(int aOffset,
                                     Sequence aSequence)
        Writes the given bytes into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aSequence - The Sequence where to copy the bytes from.
        Returns:
        The according Sequence.
      • toOverwrite

        Sequence toOverwrite​(int aOffset,
                             Sequence aSequence,
                             int aBytesOffset,
                             int aLength)
        Writes the given Sequence into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aSequence - The Sequence where to copy the bytes from.
        aBytesOffset - The offset in the Sequence where to start copying.
        aLength - The number of bytes to be copied.
        Returns:
        The according Sequence.
      • toOverwrite

        default Sequence toOverwrite​(Sequence aSequence)
        Writes the given bytes into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aSequence - The Sequence where to copy the bytes from.
        Returns:
        The according Sequence.
      • toOverwrite

        default Sequence toOverwrite​(Sequence aSequence,
                                     int aLength)
        Writes the given bytes into a copy of this Sequence. If the Sequence is too small for the bytes to fit into, then the Sequence is extended accordingly.
        Parameters:
        aSequence - The Sequence where to copy the bytes from.
        aLength - The number of bytes to be copied starting with offset 0.
        Returns:
        The according Sequence.
      • toPrepend

        default Sequence toPrepend​(byte... aBytes)
        Prepends the given bytes to the beginning of this Sequence. This Sequence is not modified and a new Sequence is returned.
        Parameters:
        aBytes - The bytes to be prepended.
        Returns:
        The according Sequence.
      • toPrepend

        Sequence toPrepend​(byte[] aBytes,
                           int aOffset,
                           int aLength)
        Prepends the given bytes to the beginning of this Sequence. This Sequence is not modified and a new Sequence is returned.
        Parameters:
        aBytes - The bytes to be prepended.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be prepended.
        Returns:
        The according Sequence.
      • toSequence

        Sequence toSequence​(int aOffset,
                            int aLength)
        Retrieves a new Sequence from this Sequence, starting with the byte at the given offset and containing the given number of bytes.
        Parameters:
        aOffset - The offset from where to start collecting the bytes.
        aLength - The length of the byte array to be returned.
        Returns:
        The according TransmissionSequenceException.
        Throws:
        IndexOutOfBoundsException - thrown in case the length overshot the available bytes.
      • toTruncate

        default Sequence toTruncate​(int aLength,
                                    org.refcodes.mixin.TruncateMode aTruncateMode)
        Returns a new Sequence truncated by the given number of bytes from the right or from the left of both, according to the given TruncateMode. If the number of bytes exceeds the actual length of the Sequence, then the Sequence will end up being empty.
        Parameters:
        aLength - The number of bytes to truncate according to the TruncateMode.
        aTruncateMode - The TruncateMode to use for truncating the Sequence.
        Returns:
        The newly created truncated Sequence.
      • toTruncateHead

        Sequence toTruncateHead​(int aLength)
        Returns a new Sequence truncated by the given number of bytes from the left. If the number of bytes exceeds the actual length of the Sequence, then the new Sequence will end up being empty.
        Parameters:
        aLength - The number of bytes to truncate from the left.
        Returns:
        The newly created truncated Sequence.
      • toTruncateTail

        Sequence toTruncateTail​(int aLength)
        Returns a new Sequence truncated by the given number of bytes from the right. If the number of bytes exceeds the actual length of the Sequence, then the new Sequence will end up being empty.
        Parameters:
        aLength - The number of bytes to truncate from the right.
        Returns:
        The newly created truncated Sequence.
      • truncate

        default void truncate​(int aLength,
                              org.refcodes.mixin.TruncateMode aTruncateMode)
        Truncates the Sequence by the given number of bytes from the right or from the left of both, according to the given TruncateMode. If the number of bytes exceeds the actual length of the Sequence, then the Sequence will end up being empty.
        Parameters:
        aLength - The number of bytes to truncate according to the TruncateMode.
        aTruncateMode - The TruncateMode to use for truncating the Sequence.
      • truncateHead

        void truncateHead​(int aLength)
        Truncates the Sequence by the given number of bytes from the left. If the number of bytes exceeds the actual length of the Sequence, then the Sequence will end up being empty.
        Parameters:
        aLength - The number of bytes to truncate from the left.
      • truncateTail

        void truncateTail​(int aLength)
        Truncates the Sequence by the given number of bytes from the right. If the number of bytes exceeds the actual length of the Sequence, then the Sequence will end up being empty.
        Parameters:
        aLength - The number of bytes to truncate from the right.
      • withAppend

        default Sequence withAppend​(byte... aBytes)
        Builder method for the append(byte...) method.
        Parameters:
        aBytes - The bytes to be appended.
        Returns:
        This instance as of the builder pattern.
      • withAppend

        default Sequence withAppend​(byte[] aBytes,
                                    int aOffset,
                                    int aLength)
        Builder method for the append(byte...) method.
        Parameters:
        aBytes - The bytes to be appended.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be appended.
        Returns:
        This instance as of the builder pattern.
      • withAppend

        default Sequence withAppend​(Sequence aSequence)
        Builder method for the append(Sequence) method.
        Parameters:
        aSequence - The Sequence to be appended.
        Returns:
        This instance as of the builder pattern.
      • withConcatenate

        default Sequence withConcatenate​(org.refcodes.mixin.ConcatenateMode aConcatenateMode,
                                         byte... aBytes)
        Builder method for the concatenate(ConcatenateMode, byte...) method.
        Parameters:
        aConcatenateMode - The concatenation mode to be used.
        aBytes - The bytes to be concatenated with.
        Returns:
        This instance as of the builder pattern.
      • withConcatenate

        default Sequence withConcatenate​(Sequence aSequence,
                                         org.refcodes.mixin.ConcatenateMode aConcatenateMode)
        Builder method for the concatenate(Sequence, ConcatenateMode) method.
        Parameters:
        aSequence - The Sequence to be concatenated with
        aConcatenateMode - The concatenation mode to be used.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(byte[] aBytes)
        Builder method for the overwrite(byte[]) method.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(byte[] aBytes,
                                       int aLength)
        Builder method for the overwrite(Sequence, int) method.
        Parameters:
        aBytes - The bytes where to copy the bytes from.
        aLength - The number of bytes to be copied starting at offset 0.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(int aOffset,
                                       byte[] aBytes)
        Builder method for the overwrite(int, byte[]) method.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aBytes - The byte array where to copy the bytes from.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(int aOffset,
                                       byte[] aBytes,
                                       int aBytesOffset,
                                       int aLength)
        Builder method for the overwrite(int, byte[], int, int) method.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aBytes - The byte array where to copy the bytes from.
        aBytesOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(int aOffset,
                                       Sequence aSequence)
        Builder method for the overwrite(int, Sequence) method.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aSequence - The Sequence where to copy the bytes from.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(int aOffset,
                                       Sequence aSequence,
                                       int aSequenceOffset,
                                       int aLength)
        Builder method for the overwrite(int, Sequence, int, int) method.
        Parameters:
        aOffset - The offset where to start writing the bytes to.
        aSequence - The Sequence where to copy the bytes from.
        aSequenceOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(Sequence aSequence)
        Builder method for the overwrite(Sequence) method.
        Parameters:
        aSequence - The Sequence where to copy the bytes from.
        Returns:
        This instance as of the builder pattern.
      • withOverwrite

        default Sequence withOverwrite​(Sequence aSequence,
                                       int aLength)
        Builder method for the overwrite(Sequence, int) method.
        Parameters:
        aSequence - The Sequence where to copy the bytes from.
        aLength - The number of bytes to be copied starting at offset 0.
        Returns:
        This instance as of the builder pattern.
      • withPrepend

        default Sequence withPrepend​(byte... aBytes)
        Builder method for the prepend(byte...) method.
        Parameters:
        aBytes - The bytes to be prepended.
        Returns:
        This instance as of the builder pattern.
      • withPrepend

        default Sequence withPrepend​(byte[] aBytes,
                                     int aOffset,
                                     int aLength)
        Builder method for the prepend(byte...) method.
        Parameters:
        aBytes - The bytes to be prepended.
        aOffset - The offset from where to start collecting the bytes.
        aLength - The number of bytes to be prepended.
        Returns:
        This instance as of the builder pattern.
      • withPrepend

        default Sequence withPrepend​(Sequence aSequence)
        Builder method for the prepend(Sequence) method.
        Parameters:
        aSequence - The Sequence to be prepended.
        Returns:
        This instance as of the builder pattern.
      • withReplace

        default Sequence withReplace​(byte[] aBytes)
        Builder method for the replace(byte[]) method.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        Returns:
        This instance as of the builder pattern.
      • withReplace

        default Sequence withReplace​(byte[] aBytes,
                                     int aLength)
        Builder method for the replace(byte[], int, int) method.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        aLength - The number of bytes to be copied starting at offset 0.
        Returns:
        This instance as of the builder pattern.
      • withReplace

        default Sequence withReplace​(Sequence aSequence,
                                     int aLength)
        Builder method for the replace(Sequence, int, int) method.
        Parameters:
        aSequence - The byte Sequence where to copy the bytes from.
        aLength - The number of bytes to be copied starting at offset 0.
        Returns:
        This instance as of the builder pattern.
      • withReplace

        default Sequence withReplace​(byte[] aBytes,
                                     int aOffset,
                                     int aLength)
        Builder method for the replace(byte[], int, int) method.
        Parameters:
        aBytes - The byte array where to copy the bytes from.
        aOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
        Returns:
        This instance as of the builder pattern.
      • withReplace

        default Sequence withReplace​(Sequence aSequence)
        Builder method for the replace(Sequence) method.
        Parameters:
        aSequence - The Sequence where to copy the bytes from.
        Returns:
        This instance as of the builder pattern.
      • withReplace

        default Sequence withReplace​(Sequence aSequence,
                                     int aOffset,
                                     int aLength)
        Builder method for the replace(Sequence, int, int) method.
        Parameters:
        aSequence - The Sequence where to copy the bytes from.
        aOffset - The offset in the byte array where to start copying.
        aLength - The number of bytes to be copied.
        Returns:
        This instance as of the builder pattern.
      • withTruncate

        default Sequence withTruncate​(int aLength,
                                      org.refcodes.mixin.TruncateMode aTruncateMode)
        Builder method for the truncate(int, TruncateMode) method.
        Parameters:
        aLength - The number of bytes to truncate according to the TruncateMode.
        aTruncateMode - The TruncateMode to use for truncating the Sequence.
        Returns:
        This instance as of the builder pattern.
      • withTruncateHead

        default Sequence withTruncateHead​(int aLength)
        Builder method for the truncateHead(int) method.
        Parameters:
        aLength - The number of bytes to truncate.
        Returns:
        This instance as of the builder pattern.
      • withTruncateTail

        default Sequence withTruncateTail​(int aLength)
        Builder method for the truncateTail(int) method.
        Parameters:
        aLength - The number of bytes to truncate.
        Returns:
        This instance as of the builder pattern.