Class CodeEscape

java.lang.Object
com.killcoding.tool.CodeEscape

public final class CodeEscape extends Object
  • Constructor Details

  • Method Details

    • escapeToSingleLineForCsv

      public static String escapeToSingleLineForCsv(String text)
    • escapeJavaMinimal

      public static String escapeJavaMinimal(String text)
    • escapeJava

      public static String escapeJava(String text)
    • escapeJava

      public static String escapeJava(String text, CodeEscapeLevel level)
    • escapeJavaMinimal

      public static void escapeJavaMinimal(String text, Writer writer) throws IOException
      Throws:
      IOException
    • escapeJava

      public static void escapeJava(String text, Writer writer) throws IOException
      Throws:
      IOException
    • escapeJava

      public static void escapeJava(String text, Writer writer, CodeEscapeLevel level) throws IOException
      Throws:
      IOException
    • escapeJavaMinimal

      public static void escapeJavaMinimal(Reader reader, Writer writer) throws IOException
      Throws:
      IOException
    • escapeJava

      public static void escapeJava(Reader reader, Writer writer) throws IOException
      Throws:
      IOException
    • escapeJava

      public static void escapeJava(Reader reader, Writer writer, CodeEscapeLevel level) throws IOException
      Throws:
      IOException
    • escapeJavaMinimal

      public static void escapeJavaMinimal(char[] text, int offset, int len, Writer writer) throws IOException
      Throws:
      IOException
    • escapeJava

      public static void escapeJava(char[] text, int offset, int len, Writer writer) throws IOException
      Throws:
      IOException
    • escapeJava

      public static void escapeJava(char[] text, int offset, int len, Writer writer, CodeEscapeLevel level) throws IOException
      Throws:
      IOException
    • unescapeJava

      public static String unescapeJava(String text)

      Perform a Java unescape operation on a String input.

      No additional configuration arguments are required. Unescape operations will always perform complete Java unescape of SECs, u-based and octal escapes.

      This method is thread-safe.

      Parameters:
      text - the String to be unescaped.
      Returns:
      The unescaped result String. As a memory-performance improvement, will return the exact same object as the text input argument if no unescaping modifications were required (and no additional String objects will be created during processing). Will return null if input is null.
    • unescapeJava

      public static void unescapeJava(String text, Writer writer) throws IOException

      Perform a Java unescape operation on a String input, writing results to a Writer.

      No additional configuration arguments are required. Unescape operations will always perform complete Java unescape of SECs, u-based and octal escapes.

      This method is thread-safe.

      Parameters:
      text - the String to be unescaped.
      writer - the java.io.Writer to which the unescaped result will be written. Nothing will be written at all to this writer if input is null.
      Throws:
      IOException - if an input/output exception occurs
      Since:
      1.1.2
    • unescapeJava

      public static void unescapeJava(Reader reader, Writer writer) throws IOException

      Perform a Java unescape operation on a Reader input, writing results to a Writer.

      No additional configuration arguments are required. Unescape operations will always perform complete Java unescape of SECs, u-based and octal escapes.

      This method is thread-safe.

      Parameters:
      reader - the Reader reading the text to be unescaped.
      writer - the java.io.Writer to which the unescaped result will be written. Nothing will be written at all to this writer if input is null.
      Throws:
      IOException - if an input/output exception occurs
      Since:
      1.1.2
    • unescapeJava

      public static void unescapeJava(char[] text, int offset, int len, Writer writer) throws IOException

      Perform a Java unescape operation on a char[] input.

      No additional configuration arguments are required. Unescape operations will always perform complete Java unescape of SECs, u-based and octal escapes.

      This method is thread-safe.

      Parameters:
      text - the char[] to be unescaped.
      offset - the position in text at which the unescape operation should start.
      len - the number of characters in text that should be unescaped.
      writer - the java.io.Writer to which the unescaped result will be written. Nothing will be written at all to this writer if input is null.
      Throws:
      IOException - if an input/output exception occurs