Module swim.codec
Package swim.codec

Class UtfErrorMode

  • All Implemented Interfaces:
    Debug

    public abstract class UtfErrorMode
    extends Object
    implements Debug
    Unicode transformation format error handling mode.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract <T> Output<T> debug​(Output<T> output)
      Writes a developer readable, debug-formatted string representation of this object to output.
      static UtfErrorMode fatal()
      Returns a UtfErrorMode that aborts Unicode decoding with an error when invalid code unit sequences are encountered.
      static UtfErrorMode fatalNonZero()
      Returns a UtfErrorMode that aborts Unicode decoding with an error when invalid code unit sequences, and NUL bytes, are encountered.
      boolean isFatal()
      Returns true if a Unicode decoding should abort with an error when an invalid code unit sequence is encountered.
      abstract boolean isNonZero()
      Returns true if Unicode decoding should abort with an error when a NUL byte is encountered.
      abstract UtfErrorMode isNonZero​(boolean isNonZero)
      Returns a UtfErrorMode that, if isNonZero is true, aborts when Unicode decoding encounters a NUL byte.
      boolean isReplacement()
      Returns true if a Unicode decoding should substitute invalid code unit sequences with a replacement character.
      static UtfErrorMode replacement()
      Returns a UtfErrorMode that substitutes invalid code unit sequences with the replacement character (U+FFFD).
      static UtfErrorMode replacement​(int replacementChar)
      Returns a UtfErrorMode that substitutes invalid code unit sequences with the given replacementChar.
      int replacementChar()
      Returns the Unicode code point of the replacement character to substitute for invalid code unit sequences.
      static UtfErrorMode replacementNonZero()
      Returns a UtfErrorMode that substitutes invalid code unit sequences with the replacement character (U+FFFD), and aborts decoding with an error when NUL bytes are encountered.
      static UtfErrorMode replacementNonZero​(int replacementChar)
      Returns a UtfErrorMode that substitutes invalid code unit sequences with the given replacementChar, and aborts decoding with an error when NUL bytes are encountered.
      String toString()  
    • Method Detail

      • isFatal

        public boolean isFatal()
        Returns true if a Unicode decoding should abort with an error when an invalid code unit sequence is encountered.
      • isReplacement

        public boolean isReplacement()
        Returns true if a Unicode decoding should substitute invalid code unit sequences with a replacement character.
      • replacementChar

        public int replacementChar()
        Returns the Unicode code point of the replacement character to substitute for invalid code unit sequences. Defaults to U+FFFD.
      • isNonZero

        public abstract boolean isNonZero()
        Returns true if Unicode decoding should abort with an error when a NUL byte is encountered.
      • isNonZero

        public abstract UtfErrorMode isNonZero​(boolean isNonZero)
        Returns a UtfErrorMode that, if isNonZero is true, aborts when Unicode decoding encounters a NUL byte.
      • debug

        public abstract <T> Output<T> debug​(Output<T> output)
        Description copied from interface: Debug
        Writes a developer readable, debug-formatted string representation of this object to output.
        Specified by:
        debug in interface Debug
        Returns:
        the continuation of the output.
      • fatal

        public static UtfErrorMode fatal()
        Returns a UtfErrorMode that aborts Unicode decoding with an error when invalid code unit sequences are encountered.
      • fatalNonZero

        public static UtfErrorMode fatalNonZero()
        Returns a UtfErrorMode that aborts Unicode decoding with an error when invalid code unit sequences, and NUL bytes, are encountered.
      • replacement

        public static UtfErrorMode replacement()
        Returns a UtfErrorMode that substitutes invalid code unit sequences with the replacement character (U+FFFD).
      • replacement

        public static UtfErrorMode replacement​(int replacementChar)
        Returns a UtfErrorMode that substitutes invalid code unit sequences with the given replacementChar.
      • replacementNonZero

        public static UtfErrorMode replacementNonZero()
        Returns a UtfErrorMode that substitutes invalid code unit sequences with the replacement character (U+FFFD), and aborts decoding with an error when NUL bytes are encountered.
      • replacementNonZero

        public static UtfErrorMode replacementNonZero​(int replacementChar)
        Returns a UtfErrorMode that substitutes invalid code unit sequences with the given replacementChar, and aborts decoding with an error when NUL bytes are encountered.