/** * Unescapes the escaped entities in the <code>String</code> passed and writes the result to the * <code>Writer</code> passed. * * @param writer The <code>Writer</code> to write the results to; assumed to be non-null. * @param str The source <code>String</code> to unescape; assumed to be non-null. * @throws IOException when <code>Writer</code> passed throws the exception from calls to the * {@link Writer#write(int)} methods. * @see #escape(String) * @see Writer */ public void unescape(Writer writer, String str) throws IOException { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { writer.write(str); return; } else { doUnescape(writer, str, firstAmp); } }