Package org.agrona

Class AsciiSequenceView

  • All Implemented Interfaces:
    java.lang.CharSequence

    public class AsciiSequenceView
    extends java.lang.Object
    implements java.lang.CharSequence
    View over a DirectBuffer which contains an ASCII string for a given range.
    • Field Detail

      • offset

        private int offset
      • length

        private int length
    • Constructor Detail

      • AsciiSequenceView

        public AsciiSequenceView()
        Default constructor.
      • AsciiSequenceView

        public AsciiSequenceView​(DirectBuffer buffer,
                                 int offset,
                                 int length)
        Construct a view over a DirectBuffer from an offset for a given length.
        Parameters:
        buffer - containing the ASCII sequence.
        offset - at which the ASCII sequence begins.
        length - of the ASCII sequence in bytes.
    • Method Detail

      • length

        public int length()
        Specified by:
        length in interface java.lang.CharSequence
      • buffer

        public DirectBuffer buffer()
        Gets the underlying buffer which this is a view over.
        Returns:
        the underlying buffer which this is a view over.
      • offset

        public int offset()
        Gets the offset into the underlying buffer.
        Returns:
        the offset into the underlying buffer.
      • charAt

        public char charAt​(int index)
        Specified by:
        charAt in interface java.lang.CharSequence
      • subSequence

        public AsciiSequenceView subSequence​(int start,
                                             int end)
        Specified by:
        subSequence in interface java.lang.CharSequence
      • wrap

        public AsciiSequenceView wrap​(DirectBuffer buffer,
                                      int offset,
                                      int length)
        Wrap a range of an existing buffer containing an ASCII sequence.
        Parameters:
        buffer - containing the ASCII sequence.
        offset - at which the ASCII sequence begins.
        length - of the ASCII sequence in bytes.
        Returns:
        this for a fluent API.
      • reset

        public void reset()
        Reset the view to null.
      • getBytes

        public int getBytes​(MutableDirectBuffer dstBuffer,
                            int dstOffset)
        Copy the bytes from a view into a provided buffer.
        Parameters:
        dstBuffer - into which the bytes will be copied.
        dstOffset - offset in the destination buffer to begin the copy.
        Returns:
        the number of bytes copied.
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface java.lang.CharSequence
        Overrides:
        toString in class java.lang.Object