Package monq.jfa

Class Misc

java.lang.Object
monq.jfa.Misc

public class Misc extends Object
Miscellaneous static functions.
  • Field Details

  • Method Details

    • printable

      public static String printable(char ch)
      converts a character into something which can be printed on the console
    • printable

      public static void printable(StringBuilder out, char ch)
    • printable

      public static CharSequence printable(CharSequence s)
    • decodeEscape

      public static char decodeEscape(IntSupplier chSource, Runnable unreadChar) throws IOException
      Call this on a source of characters, given by chSource, which returns -1 to signal end of input. Typically the source has just delivered an escape character like backslash. The conversion of the next characters follows String.translateEscapes(). In addition '\uXXXX` and `\xXX` are decoded requiring exactly 4, respectively 2, hex digits.
      Parameters:
      chSource - to read characters from or -1 for end of input
      unreadChar - sadly we may overread one character and must be able to hand it back
      Returns:
      the decoded character
      Throws:
      IOException - on end of input or an illegal character