use of org.apache.commons.io.output.CloseShieldOutputStream in project xwiki-platform by xwiki.
the class XMLWriter method writeBase64.
/**
* Writes the <code>{@link Element}</code>, including its <code>{@link
* Attribute}</code>s, using the
* <code>{@link InputStream}</code> encoded in Base64 for its content.
*
* @param element <code>{@link Element}</code> to output.
* @param is <code>{@link InputStream}</code> that will be fully read and encoded
* in Base64 into the element content.
* @throws IOException a problem occurs during reading or writing.
*/
public void writeBase64(final Element element, final InputStream is) throws IOException {
this.writeOpen(element);
super.writePrintln();
super.flush();
final Base64OutputStream base64 = new Base64OutputStream(new CloseShieldOutputStream(this.out), true, BASE64_WIDTH, NEWLINE);
IOUtils.copy(is, base64);
base64.close();
// The last char written was a newline, not a > so it will not indent unless it is done manually.
super.setIndentLevel(this.parent.size() - 1);
super.indent();
this.writeClose(element);
}
use of org.apache.commons.io.output.CloseShieldOutputStream in project repseqio by repseqio.
the class GRepertoireWriter method write.
public void write(GClone clone) throws IOException {
writer.writeValue(new CloseShieldOutputStream(os), clone);
os.write('\n');
}
Aggregations