Package com.oracle.truffle.api.strings
Class InternalByteArray
java.lang.Object
com.oracle.truffle.api.strings.InternalByteArray
Wrapper object containing a
TruffleString
's internal byte array, along with a byte offset
and length defining the region in use.- Since:
- 22.1
-
Method Summary
Modifier and TypeMethodDescriptionbyte
get
(int index) Read the byte atgetArray()[getOffset() + index]
and return it as a byte, similar toTruffleString.ReadByteNode
.byte[]
getArray()
Get the internal byte array.int
getEnd()
Get the string region's end (offset + length
).int
Get the string region's length.int
Get the string region's starting index.
-
Method Details
-
getArray
public byte[] getArray()Get the internal byte array. Do not modify the array's contents!- Since:
- 22.1
-
getOffset
public int getOffset()Get the string region's starting index.- Since:
- 22.1
-
getLength
public int getLength()Get the string region's length.- Since:
- 22.1
-
getEnd
public int getEnd()Get the string region's end (offset + length
).- Since:
- 22.1
-
get
public byte get(int index) Read the byte atgetArray()[getOffset() + index]
and return it as a byte, similar toTruffleString.ReadByteNode
. Consider usingTruffleString.ReadByteNode
(andTruffleString.MaterializeNode
before) instead if not needing the byte[] for other purposes, as that will avoid extra copying if the stringis stored in native memory
.- Since:
- 22.2
-