Examples of Base64InputStream


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

    if (httpResponse != null) {
      String content = "";
      if (httpResponse.getContentLength() > 0) {
        // Stream out the base64-encoded data.
        // Ctor args indicate to encode w/o line breaks.
        Base64InputStream b64input =
            new Base64InputStream(httpResponse.getResponse(), true, 0, null);
        content = IOUtils.toString(b64input);
      }

      ImmutableList.Builder<GadgetsHandlerApi.NameValuePair> headersBuilder =
          ImmutableList.builder();
View Full Code Here

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

    if (httpResponse != null) {
      String content = "";
      if (httpResponse.getContentLength() > 0) {
        // Stream out the base64-encoded data.
        // Ctor args indicate to encode w/o line breaks.
        Base64InputStream b64input =
            new Base64InputStream(httpResponse.getResponse(), true, 0, null);
        content = IOUtils.toString(b64input);
      }

      ImmutableList.Builder<GadgetsHandlerApi.NameValuePair> headersBuilder =
          ImmutableList.builder();
View Full Code Here

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

    pw.write(",");
    pw.flush();

    // Stream out the base64-encoded data.
    // Ctor args indicate to encode w/o line breaks.
    Base64InputStream b64input = new Base64InputStream(response.getResponse(), true, 0, null);
    byte[] buf = new byte[1024];

    try {
      int read;
      while (( read = b64input.read(buf, 0, 1024)) > 0) {
        os.write(buf, 0, read);
      }
    } finally {
      IOUtils.closeQuietly(b64input);
    }
View Full Code Here

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

    @Override
    public void transform(InputStream inputStream) throws XMLStreamException {
        if (getOutputStream() != null) {
            super.transform(inputStream);
        } else {
            super.transform(new Base64InputStream(inputStream, false));
        }
    }
View Full Code Here

Examples of org.apache.james.mime4j.codec.Base64InputStream

    }

    private InputStream decodedStream(InputStream instream) {
        String transferEncoding = body.getTransferEncoding();
        if (MimeUtil.isBase64Encoding(transferEncoding)) {
            instream = new Base64InputStream(instream, monitor);
        } else if (MimeUtil.isQuotedPrintableEncoded(transferEncoding)) {
            instream = new QuotedPrintableInputStream(instream, monitor);
        }
        return instream;
    }
View Full Code Here

Examples of org.apache.james.mime4j.codec.Base64InputStream

        OutputStream nullOut = new NullOutputStream();

        for (int i = 0; i < 5; i++) {
            ByteArrayInputStream ed = new ByteArrayInputStream(encoded);
            InputStream in = new Base64InputStream(ed);
            CodecUtil.copy(in, nullOut);
        }
        Thread.sleep(100);

        // test

        long t0 = System.currentTimeMillis();

        final int repetitions = 50;
        for (int i = 0; i < repetitions; i++) {
            ByteArrayInputStream ed = new ByteArrayInputStream(encoded);
            InputStream in = new Base64InputStream(ed);
            CodecUtil.copy(in, nullOut);
        }

        long dt = System.currentTimeMillis() - t0;
        long totalBytes = data.length * (long) repetitions;
View Full Code Here

Examples of org.apache.james.mime4j.codec.Base64InputStream

    }

    private static void testDecode(byte[] data, final byte[] encoded)
            throws IOException {
        ByteArrayInputStream ed = new ByteArrayInputStream(encoded);
        InputStream in = new Base64InputStream(ed);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        CodecUtil.copy(in, out);

        compare(data, out.toByteArray());
    }
View Full Code Here

Examples of org.apache.james.mime4j.codec.Base64InputStream

                    // oftwewel: gebruik getDecodedInputStream
                    InputStream bodyDataStream;
                    if (MimeUtil.isQuotedPrintableEncoded(stream.getBodyDescriptor().getTransferEncoding())) {
                        bodyDataStream = new QuotedPrintableInputStream(new EOLConvertingInputStream(stream.getInputStream(), EOLConvertingInputStream.CONVERT_LF));
                    } else if (MimeUtil.isBase64Encoding(stream.getBodyDescriptor().getTransferEncoding())) {
                        bodyDataStream = new Base64InputStream(stream.getInputStream());
                    } else {
                        bodyDataStream = stream.getInputStream();
                    }

                    byte[] data = IOUtils.toByteArray(bodyDataStream);
View Full Code Here

Examples of org.apache.james.mime4j.decoder.Base64InputStream

          mimeToContent.put(mimeType, strBuilder);
        }

        /* Handle encodings */
        if (bd.isBase64Encoded())
          is = new Base64InputStream(is);
        else if (bd.isQuotedPrintableEncoded())
          is = new QuotedPrintableInputStream(is);

        /* Read Body */
        BufferedReader reader;
View Full Code Here

Examples of org.apache.james.mime4j.decoder.Base64InputStream

    /**
     * @see org.apache.james.mime4j.parser.AbstractContentHandler#body(org.apache.james.mime4j.descriptor.BodyDescriptor, java.io.InputStream)
     */
    public final void body(BodyDescriptor bd, InputStream is) throws IOException {
        if (MimeUtil.isBase64Encoding(bd.getTransferEncoding())) {
            bodyDecoded(bd, new Base64InputStream(is));
        }
        else if (MimeUtil.isQuotedPrintableEncoded(bd.getTransferEncoding())) {
            bodyDecoded(bd, new QuotedPrintableInputStream(is));
        }
        else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.