Examples of Base64InputStream


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

    }

    static public void appendBinFile(OutputStream out, File inputFile, boolean enc64, boolean dec64) throws FileNotFoundException, IOException {
        BufferedOutputStream bout=new BufferedOutputStream(out);
        FileInputStream in=new FileInputStream(inputFile);
        Base64InputStream in64=new Base64InputStream(in, enc64);
        InputStream input = (enc64^dec64) ? in64 : in;
        byte buf[]=new byte[4096];
        byte outBuf[]=buf;
        int read=input.read(buf);
        while(read!=-1){
View Full Code Here

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

        }
    }*/
    static void base64File2HexFile(File inputFile, File outputFile) throws IOException {
        FileWriter writer = new FileWriter(outputFile);
        FileInputStream inBin = new FileInputStream(inputFile);
        InputStream in=new Base64InputStream(inBin);//base64 decode
        int byteCnt=0;
        String endl=AStringUtilities.systemNewLine;
        try{
            while(true){
                int bin=in.read();
                if(-1==bin)
                    break;
                String hex=AStringUtilities.byteToHex(bin);
                //System.out.println(hex);
                writer.write(hex);
                byteCnt++;
                if(16==byteCnt){
                    byteCnt=0;
                    writer.write(endl);
                }
            }
        } finally{
            writer.close();
            in.close();
        }
    }
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

    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

        stream.flush();
    }

    @Override
    public Object unmarshal(Exchange exchange, InputStream input) throws Exception {
        return new Base64InputStream(input, false, lineLength, lineSeparator);
    }
View Full Code Here

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

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

        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

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

        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

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

    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
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.