Class HtmlQuoting

java.lang.Object
org.apache.hadoop.hbase.http.HtmlQuoting

@Private public final class HtmlQuoting extends Object
This class is responsible for quoting HTML characters.
  • Field Details

    • ampBytes

      private static final byte[] ampBytes
    • aposBytes

      private static final byte[] aposBytes
    • gtBytes

      private static final byte[] gtBytes
    • ltBytes

      private static final byte[] ltBytes
    • quotBytes

      private static final byte[] quotBytes
  • Constructor Details

  • Method Details

    • needsQuoting

      public static boolean needsQuoting(byte[] data, int off, int len)
      Does the given string need to be quoted?
      Parameters:
      data - the string to check
      off - the starting position
      len - the number of bytes to check
      Returns:
      does the string contain any of the active html characters?
    • needsQuoting

      public static boolean needsQuoting(String str)
      Does the given string need to be quoted?
      Parameters:
      str - the string to check
      Returns:
      does the string contain any of the active html characters?
    • quoteHtmlChars

      public static void quoteHtmlChars(OutputStream output, byte[] buffer, int off, int len) throws IOException
      Quote all of the active HTML characters in the given string as they are added to the buffer.
      Parameters:
      output - the stream to write the output to
      buffer - the byte array to take the characters from
      off - the index of the first byte to quote
      len - the number of bytes to quote
      Throws:
      IOException
    • quoteHtmlChars

      public static String quoteHtmlChars(String item)
      Quote the given item to make it html-safe.
      Parameters:
      item - the string to quote
      Returns:
      the quoted string
    • quoteOutputStream

      Return an output stream that quotes all of the output.
      Parameters:
      out - the stream to write the quoted output to
      Returns:
      a new stream that the application show write to
    • unquoteHtmlChars

      public static String unquoteHtmlChars(String item)
      Remove HTML quoting from a string.
      Parameters:
      item - the string to unquote
      Returns:
      the unquoted string
    • main

      public static void main(String[] args)