### Question:
HtmlQuoting { public static void quoteHtmlChars(OutputStream output, byte[] buffer, int off, int len) throws IOException { for(int i=off; i < off+len; i++) { switch (buffer[i]) { case '&': output.write(ampBytes); break; case '<': output.write(ltBytes); break; case '>': output.write(gtBytes); break; case '\'': output.write(aposBytes); break; case '"': output.write(quotBytes); break; default: output.write(buffer, i, 1); } } }  static boolean needsQuoting(byte[] data, int off, int len); static boolean needsQuoting(String str); static void quoteHtmlChars(OutputStream output, byte[] buffer,
                                    int off, int len); static String quoteHtmlChars(String item); static OutputStream quoteOutputStream(final OutputStream out
                                               ); static String unquoteHtmlChars(String item); static void main(String[] args);  }### Answer:
@Test public void testQuoting() throws Exception { assertEquals("ab&lt;cd", HtmlQuoting.quoteHtmlChars("ab<cd")); assertEquals("ab&gt;", HtmlQuoting.quoteHtmlChars("ab>")); assertEquals("&amp;&amp;&amp;", HtmlQuoting.quoteHtmlChars("&&&")); assertEquals(" &apos;\n", HtmlQuoting.quoteHtmlChars(" '\n")); assertEquals("&quot;", HtmlQuoting.quoteHtmlChars("\"")); assertEquals(null, HtmlQuoting.quoteHtmlChars(null)); }