Class JSONFilter


  • public class JSONFilter
    extends java.lang.Object
    Provides escaping of values so they can be included in a JSON document. Escaping is based on the definition of JSON found in RFC 8259.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static char[] escape​(char c)
      Escape the given char.
      static java.lang.CharSequence escape​(java.lang.CharSequence input)
      Escape the given char sequence.
      static java.lang.CharSequence escape​(java.lang.CharSequence input, int off, int length)
      Escape the given char sequence.
      static java.lang.String escape​(java.lang.String input)
      Escape the given string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • escape

        public static char[] escape​(char c)
        Escape the given char.
        Parameters:
        c - the char
        Returns:
        a char array with the escaped sequence
      • escape

        public static java.lang.String escape​(java.lang.String input)
        Escape the given string.
        Parameters:
        input - the string
        Returns:
        the escaped string
      • escape

        public static java.lang.CharSequence escape​(java.lang.CharSequence input)
        Escape the given char sequence.
        Parameters:
        input - the char sequence
        Returns:
        the escaped char sequence
      • escape

        public static java.lang.CharSequence escape​(java.lang.CharSequence input,
                                                    int off,
                                                    int length)
        Escape the given char sequence.
        Parameters:
        input - the char sequence
        off - the offset on which escaping will start
        length - the length which should be escaped
        Returns:
        the escaped char sequence corresponding to the specified range