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

public abstract static class TruffleString.SwitchEncodingNode extends Node
Node to get a given string in a specific encoding. See execute(AbstractTruffleString, TruffleString.Encoding) for details.
Since:
22.1
  • Method Details

    • execute

      public final TruffleString execute(AbstractTruffleString a, TruffleString.Encoding encoding)
      Returns a version of string a 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 string a 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 with errorHandler.
      Since:
      23.1
    • create

      public static TruffleString.SwitchEncodingNode create()
      Since:
      22.1
    • getUncached

      public static TruffleString.SwitchEncodingNode getUncached()
      Get the uncached version of TruffleString.SwitchEncodingNode.
      Since:
      22.1