Search in sources :

Example 11 with CloseShieldOutputStream

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);
}
Also used : Base64OutputStream(org.apache.commons.codec.binary.Base64OutputStream) CloseShieldOutputStream(org.apache.commons.io.output.CloseShieldOutputStream)

Example 12 with CloseShieldOutputStream

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');
}
Also used : CloseShieldOutputStream(org.apache.commons.io.output.CloseShieldOutputStream)

Aggregations

CloseShieldOutputStream (org.apache.commons.io.output.CloseShieldOutputStream)12 ZipEntry (java.util.zip.ZipEntry)4 BasicColor (com.github.rvesse.airline.io.colors.BasicColor)2 AnsiBasicColorizedOutputStream (com.github.rvesse.airline.io.output.AnsiBasicColorizedOutputStream)2 Base64OutputStream (org.apache.commons.codec.binary.Base64OutputStream)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 ParseException (com.github.rvesse.airline.parser.errors.ParseException)1 NucleotideSequence (com.milaboratory.core.sequence.NucleotideSequence)1 VDJCLibrary (io.repseq.core.VDJCLibrary)1 GClone (io.repseq.gen.GClone)1 GGene (io.repseq.gen.GGene)1 GCloneGenerator (io.repseq.gen.dist.GCloneGenerator)1 GCloneModel (io.repseq.gen.dist.GCloneModel)1 BufferedOutputStream (java.io.BufferedOutputStream)1 EOFException (java.io.EOFException)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1