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.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AsciiSequenceView
(DirectBuffer buffer, int offset, int length) Construct a view over aDirectBuffer
from an offset for a given length. -
Method Summary
Modifier and TypeMethodDescriptionbuffer()
Gets the underlying buffer which this is a view over.char
charAt
(int index) int
getBytes
(MutableDirectBuffer dstBuffer, int dstOffset) Copy the bytes from a view into a provided buffer.int
length()
int
offset()
Gets the offset into the underlying buffer.void
reset()
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, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
buffer
-
offset
private int offset -
length
private int length
-
-
Constructor Details
-
AsciiSequenceView
public AsciiSequenceView()Default constructor. -
AsciiSequenceView
Construct a view over aDirectBuffer
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 Details
-
length
public int length()- Specified by:
length
in 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:
charAt
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in 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:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-