/** * Parses a byte array containing HTML code with different parsing modes.<p> * * @param htmlInput a byte array containing raw HTML code * @param encoding the encoding * * @return parsed and cleared HTML code * * @throws UnsupportedEncodingException if the encoding set for the conversion is not supported */ private String parse(String htmlInput) throws UnsupportedEncodingException { // prepare the streams ByteArrayInputStream in = new ByteArrayInputStream(htmlInput.getBytes(getEncoding())); ByteArrayOutputStream out = new ByteArrayOutputStream(); // do the parsing m_tidy.parse(in, out); // return the result byte[] result = out.toByteArray(); return new String(result, getEncoding()); }
List<String> modes = getModes(); m_tidy.setInputEncoding(getEncoding()); m_tidy.setOutputEncoding(getEncoding());
List modes = getModes(); m_tidy.setInputEncoding(getEncoding()); m_tidy.setOutputEncoding(getEncoding());
/** * Parses a byte array containing HTML code with different parsing modes.<p> * * @param htmlInput a byte array containing raw HTML code * * @return parsed and cleared HTML code * * @throws UnsupportedEncodingException if the encoding set for the conversion is not supported */ private String parse(String htmlInput) throws UnsupportedEncodingException { // prepare the streams ByteArrayInputStream in = new ByteArrayInputStream(htmlInput.getBytes(getEncoding())); ByteArrayOutputStream out = new ByteArrayOutputStream(); // do the parsing m_tidy.parse(in, out); // return the result byte[] result = out.toByteArray(); return new String(result, getEncoding()); }