Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Base64.encode()


      // read file
      byte[] ba = FileUtils.readFileToByteArray( file );

      // convert to base 64
      Base64 b64 = new Base64();
      String hex = new String( b64.encode( ba ) );
      // insert into text at cursor position
      int pos = textArea.getCaretPosition();
      StringBuffer text = new StringBuffer( textArea.getText() );
      text.insert( pos, hex );
      textArea.setText( text.toString() );
View Full Code Here


        }

        Base64 base64 = new Base64();

        try {
            byte[] byteData = base64.encode(bos.toByteArray());

            return new String(byteData);

        } catch (Throwable t) {
            String message =
View Full Code Here

            fs.create(file, true), cmp));
      final DataOutputBuffer dob = new DataOutputBuffer(REC_SIZE * 4 / 3 + 4);
      int seq = 0;
      while (infLen > 0) {
        rand.nextBytes(b);
        final byte[] b64enc = b64.encode(b); // ensures rand printable, no LF
        dob.reset();
        dob.writeInt(seq);
        System.arraycopy(dob.getData(), 0, b64enc, 0, dob.getLength());
        fout.write(b64enc);
        fout.write('\n');
View Full Code Here

    try {
      cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE");
      coder = new Base64();
      cipher.init(Cipher.ENCRYPT_MODE, key);
      byte[] cipherText = cipher.doFinal(repoUserPassword.getBytes());
      encryptPassword = new String(coder.encode(cipherText));
    } catch (Exception e) {
      e.printStackTrace();
    }
    return encryptPassword;
  }
View Full Code Here

        }

        Base64 base64 = new Base64();

        try {
            byte[] byteData = base64.encode(bos.toByteArray());

            return new String(byteData);

        } catch (Throwable t) {
            String message =
View Full Code Here

    while (input.read(buffer) != -1) {
      output.write(buffer);
    }   
   
    Base64 base64 = new Base64();
      out.write(base64.encode(output.toByteArray()))
    out.writeBytes("\r\n" + "--" + boundary + "--");
  }

  public long getContentLength() {   
    return -1;
View Full Code Here

    while (input.read(line) != -1) {
      output.write(line);
    }   
   
    Base64 base64 = new Base64();
      byte[] encoded = base64.encode(output.toByteArray());
    ByteArrayInputStream bi = new ByteArrayInputStream(base64.decode(encoded));
   
    File f = new File("info-out.png");
    if (f.exists()) f.delete();
    f.createNewFile();
View Full Code Here

        while (input.read(buffer) != -1) {
            output.write(buffer);
        }

        Base64 base64 = new Base64();
        out.write(base64.encode(output.toByteArray()));
        out.writeBytes("\r\n" + "--" + boundary + "--");
    }

    public long getContentLength() {
        return -1;
View Full Code Here

            fs.create(file, true), cmp));
      final DataOutputBuffer dob = new DataOutputBuffer(REC_SIZE * 4 / 3 + 4);
      int seq = 0;
      while (infLen > 0) {
        rand.nextBytes(b);
        final byte[] b64enc = b64.encode(b); // ensures rand printable, no LF
        dob.reset();
        dob.writeInt(seq);
        System.arraycopy(dob.getData(), 0, b64enc, 0, dob.getLength());
        fout.write(b64enc);
        fout.write('\n');
View Full Code Here

            if (password == null) password = "";

            if (type.equals(SSO_TYPE_URL_BASE64))
            {
                Base64 encoder = new Base64() ;
                userName = new String(encoder.encode(userName.getBytes()));
                password = new String(encoder.encode(password.getBytes()));
            }           
           
            source.append(userName);
            source.append("&");
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.