/** * Writes the characters to the underlying writer, detecting encoding. * * @param cbuf the buffer to write the characters from * @param off The start offset * @param len The number of characters to write * @throws IOException if an error occurs detecting the encoding */ @Override public void write(final char[] cbuf, final int off, final int len) throws IOException { if (xmlPrologWriter != null) { detectEncoding(cbuf, off, len); } else { writer.write(cbuf, off, len); } }
private static void checkXmlContent(final String xml, final String encoding, final String defaultEncoding) throws IOException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final XmlStreamWriter writer = new XmlStreamWriter(out, defaultEncoding); writer.write(xml); writer.close(); final byte[] xmlContent = out.toByteArray(); assertEquals(encoding, writer.getEncoding()); assertTrue(Arrays.equals(xml.getBytes(encoding), xmlContent)); }
/** * Write the characters to the underlying writer, detecing encoding. * * @param cbuf the buffer to write the characters from * @param off The start offset * @param len The number of characters to write * @throws IOException if an error occurs detecting the encoding */ @Override public void write(char[] cbuf, int off, int len) throws IOException { if (xmlPrologWriter != null) { detectEncoding(cbuf, off, len); } else { writer.write(cbuf, off, len); } }
/** * Write the characters to the underlying writer, detecing encoding. * * @param cbuf the buffer to write the characters from * @param off The start offset * @param len The number of characters to write * @throws IOException if an error occurs detecting the encoding */ @Override public void write(char[] cbuf, int off, int len) throws IOException { if (xmlPrologWriter != null) { detectEncoding(cbuf, off, len); } else { writer.write(cbuf, off, len); } }
/** * Write the characters to the underlying writer, detecing encoding. * * @param cbuf the buffer to write the characters from * @param off The start offset * @param len The number of characters to write * @throws IOException if an error occurs detecting the encoding */ @Override public void write(final char[] cbuf, final int off, final int len) throws IOException { if (xmlPrologWriter != null) { detectEncoding(cbuf, off, len); } else { writer.write(cbuf, off, len); } }
/** * Writes the characters to the underlying writer, detecting encoding. * * @param cbuf the buffer to write the characters from * @param off The start offset * @param len The number of characters to write * @throws IOException if an error occurs detecting the encoding */ @Override public void write(final char[] cbuf, final int off, final int len) throws IOException { if (xmlPrologWriter != null) { detectEncoding(cbuf, off, len); } else { writer.write(cbuf, off, len); } }