Package com.oracle.truffle.api.strings
Class TruffleString.SwitchEncodingNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.strings.TruffleString.SwitchEncodingNode
- All Implemented Interfaces:
NodeInterface
,Cloneable
- Enclosing class:
TruffleString
Node to get a given string in a specific encoding. See
execute(AbstractTruffleString, TruffleString.Encoding)
for details.- Since:
- 22.1
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
Node.Child, Node.Children
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Create a newTruffleString.SwitchEncodingNode
.final TruffleString
execute
(AbstractTruffleString a, TruffleString.Encoding encoding) Returns a version of stringa
that is encoded in the given encoding, which may be the string itself or a converted version.abstract TruffleString
execute
(AbstractTruffleString a, TruffleString.Encoding encoding, TranscodingErrorHandler errorHandler) Returns a version of stringa
that is encoded in the given encoding, which may be the string itself or a converted version.Get the uncached version ofTruffleString.SwitchEncodingNode
.Methods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, reportReplace, toString
-
Method Details
-
execute
Returns a version of stringa
that is encoded in the given encoding, which may be the string itself or a converted version. Note that the string itself may be returned even if it was originally created using a different encoding, if the string is byte-equivalent in both encodings.If no lossless conversion is possible, the string is converted on a best-effort basis; no exception is thrown and characters which cannot be mapped in the target encoding are replaced by
'�'
(for UTF-*) or'?'
.- Since:
- 22.1
-
execute
public abstract TruffleString execute(AbstractTruffleString a, TruffleString.Encoding encoding, TranscodingErrorHandler errorHandler) Returns a version of stringa
that is encoded in the given encoding, which may be the string itself or a converted version. Note that the string itself may be returned even if it was originally created using a different encoding, if the string is byte-equivalent in both encodings. Transcoding errors are handled witherrorHandler
.- Since:
- 23.1
-
create
Create a newTruffleString.SwitchEncodingNode
.- Since:
- 22.1
-
getUncached
Get the uncached version ofTruffleString.SwitchEncodingNode
.- Since:
- 22.1
-