Interface TranscodingErrorHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TranscodingErrorHandler
An error handler for transcoding operations such as TruffleString.SwitchEncodingNode.
Since:
23.1
  • Field Details

  • Method Details

    • apply

      TranscodingErrorHandler.ReplacementString apply(AbstractTruffleString sourceString, int byteIndex, int estimatedByteLength, TruffleString.Encoding sourceEncoding, TruffleString.Encoding targetEncoding)
      Transcoding error handler implementation. This method is called once for every byte region that could not be transcoded from sourceEncoding to targetEncoding.
      Parameters:
      sourceString - the string currently being transcoded.
      byteIndex - starting index of region that could not be transcoded.
      estimatedByteLength - estimated byte length of erroneous region.
      sourceEncoding - the source string's encoding.
      targetEncoding - the target encoding.
      Returns:
      a string to use instead of the invalid region.
      Since:
      23.1