public abstract static class TruffleString.FromNativePointerNode extends Node
TruffleStringfrom an interop object representing a native pointer. See
TruffleString.FromNativePointerNode.execute(Object, int, int, TruffleString.Encoding, boolean)for details.
|Modifier and Type||Method and Description|
Create a new
Create a new
Get the uncached version of
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, toString
public abstract TruffleString execute(Object pointerObject, int byteOffset, int byteLength, TruffleString.Encoding encoding, boolean copy)
TruffleStringfrom an interop object representing a native pointer (
true). The pointer is immediately unboxed with (
asPointer(pointerObject)) and saved in the
TruffleStringassumes that the pointer address does not change. The pointer's content is assumed to be encoded in the given encoding already. If
false, the native pointer is used directly as the new string's backing storage. Caution:
TruffleStringassumes the pointer's content to be immutable, do not modify the pointer's content after passing it to this operation!
TruffleString cannot reason about the lifetime of the native
pointer, so it is up to the user to make sure that the native pointer is valid to
access and not freed as long the
pointerObject is alive (if
false). To help with this the TruffleString keeps a reference to the given
pointerObject, so the
pointerObject is kept alive at least as long as the
TruffleString is used. In order to be able to use the string past the native pointer's
life time, convert it to a managed string via
TruffleString.AsManagedNode before the native
pointer is freed.
true, the pointer's contents are copied to a Java byte array,
and the pointer can be freed safely after the operation completes.
public static TruffleString.FromNativePointerNode create()
public static TruffleString.FromNativePointerNode getUncached()