Package org.agrona
Class AsciiSequenceView
java.lang.Object
org.agrona.AsciiSequenceView
- All Implemented Interfaces:
CharSequence
View over a
DirectBuffer which contains an ASCII string for a given range.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AsciiSequenceView(DirectBuffer buffer, int offset, int length) Construct a view over aDirectBufferfrom an offset for a given length. -
Method Summary
Modifier and TypeMethodDescriptionbuffer()Gets the underlying buffer which this is a view over.charcharAt(int index) intgetBytes(MutableDirectBuffer dstBuffer, int dstOffset) Copy the bytes from a view into a provided buffer.intlength()intoffset()Gets the offset into the underlying buffer.voidreset()Reset the view to null.subSequence(int start, int end) toString()wrap(DirectBuffer buffer, int offset, int length) Wrap a range of an existing buffer containing an ASCII sequence.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
AsciiSequenceView
public AsciiSequenceView()Default constructor. -
AsciiSequenceView
Construct a view over aDirectBufferfrom 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 Details
-
length
public int length()- Specified by:
lengthin interfaceCharSequence
-
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:
charAtin interfaceCharSequence
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
wrap
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
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
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-