Package org.apache.commons.codec.binary

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


        InputStream is = null;
        ByteArrayOutputStream baos = null;
        String base64data = null;
        try {
            is = new Base64InputStream(new FileInputStream(binaryFile), true, -1, null);
            baos  = new ByteArrayOutputStream();
            byte buf[] = new byte[1024];
            int read = -1;
            while((read = is.read(buf)) > -1) {
                baos.write(buf, 0, read);
View Full Code Here


        PostMethod httpPost = new PostMethod(url);

        RequestEntity requestEntity;
        try {
            FileInputStream message = new FileInputStream(filename);
            Base64InputStream message64 = new Base64InputStream(message, true, -1, null);
            requestEntity = new InputStreamRequestEntity(message64, "application/octet-stream");
        } catch (FileNotFoundException e) {
            Mediator.getLogger(Daemon.class.getName()).log(Level.SEVERE, "File not found.", e);
            return false;
        }
View Full Code Here

        PostMethod httpPost = new PostMethod(url);

        RequestEntity requestEntity = null;
        try {
            FileInputStream message = new FileInputStream(filename);
            Base64InputStream message64 = new Base64InputStream(message, true, -1, null);
            requestEntity = new InputStreamRequestEntity(message64, "application/octet-stream");
        } catch (FileNotFoundException e) {
            Mediator.getLogger(CpadDataExtract.class.getName()).log(Level.SEVERE, "File not found.", e);
        }
        httpPost.setRequestEntity(requestEntity);
View Full Code Here

    return baos.toByteArray();
  }

  public static byte[] decompress(byte[] contentBytes) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    GZIPInputStream bis = new GZIPInputStream(new Base64InputStream(new ByteArrayInputStream(contentBytes)));
    byte[] buffer = new byte[1024*4];
    int n = 0;
    while (-1 != (n = bis.read(buffer))) {
      out.write(buffer, 0, n);
    }
View Full Code Here

    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

    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

    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

    @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

    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];
    int read = -1;
    try {
      while ((read = b64input.read(buf, 0, 1024)) > 0) {
        os.write(buf, 0, read);
      }
    } finally {
      IOUtils.closeQuietly(b64input);
    }
View Full Code Here

    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];
    int read = -1;
    try {
      while ((read = b64input.read(buf, 0, 1024)) > 0) {
        os.write(buf, 0, read);
      }
    } finally {
      IOUtils.closeQuietly(b64input);
    }
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.