Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Base64InputStream


    oStream.close(); // this is necessary for the gzip and base64 streams
  }

  /* package */ static void decompressStream(InputStream inputStream, OutputStream outputStream) throws IOException {
    @SuppressWarnings("resource")
    InputStream iStream = new GZIPInputStream(new Base64InputStream(new BufferedInputStream(inputStream), false, -1, null));
    OutputStream oStream = new BufferedOutputStream(outputStream);
    byte[] buffer = new byte[2048];
    int bytesRead;
    while ((bytesRead = iStream.read(buffer)) != -1) {
      oStream.write(buffer, 0, bytesRead);
View Full Code Here


            writer.writeStartDocument(PlanXMLConstants.ENCODING,"1.0");
            writer.writeStartElement("data");
            writer.writeAttribute("id", "" + id);

            Base64InputStream base64EncodingIn = new Base64InputStream( data, true, PlanXMLConstants.BASE64_LINE_LENGTH, PlanXMLConstants.BASE64_LINE_BREAK);
           
            OutputStream out = new WriterOutputStream(new XMLStreamContentWriter(writer) , PlanXMLConstants.ENCODING);
            // read the binary data and encode it on the fly
            IOUtils.copy(base64EncodingIn, out);
            out.flush();
View Full Code Here

     */
    private static HasInputStream wrap(final HasInputStream hasResourceStream, final boolean doEncode) {
        return new HasInputStream() {
            @Override
            public InputStream getInputStream() throws IOException {
                return new Base64InputStream(hasResourceStream.getInputStream(), doEncode);
            }

            @Override
            public long writeContent(OutputStream outputStream) throws IOException {
                Base64OutputStream codec = new Base64OutputStream(outputStream, doEncode);
View Full Code Here

TOP

Related Classes of org.apache.commons.codec.binary.Base64InputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.