Package org.apache.commons.codec.binary

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


      }
   }
  
   public String encode(String line) {
      Base64 codec = new Base64();
      return new String(codec.encode(line.getBytes()));
   }
  
   public static void main(String[] args) {
      PoetryEmitter pe = new PoetryEmitter();
      pe.emit(pe.poe());
View Full Code Here


        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/unauthorized-repo" );

        Encoder encoder = new Base64();
        String userPass = "unauthUser:unauthPass";
        String encodedUserPass = new String( (byte[]) encoder.encode( userPass.getBytes() ) );
        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );

        try
        {
            WebResponse resp = client.getResponse( request );
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

            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

        tmp.append(credentials.getUserPrincipal().getName());
        tmp.append(":");
        tmp.append((credentials.getPassword() == null) ? "null" : credentials.getPassword());

        final Base64 base64codec = new Base64(0);
        final byte[] base64password = base64codec.encode(
                EncodingUtils.getBytes(tmp.toString(), getCredentialsCharset(request)));

        final CharArrayBuffer buffer = new CharArrayBuffer(32);
        if (isProxy()) {
            buffer.append(AUTH.PROXY_AUTH_RESP);
View Full Code Here

           oos.writeObject(obj);
           oos.close();
           zos.close();
           baos.close();
           Base64 base64Codec = new Base64();
           return new String(base64Codec.encode( baos.toByteArray() ), ZIP_CHARSET);
       }
       catch (IOException e)
       {
           log.fatal("Cannot encode Object with Base64", e);
           throw new FacesException(e);
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

        byte[] digest = md.digest();

        Base64 b64 = new Base64();

        byte[] encoded = b64.encode(digest);

        output(args[0], encoded);
    }

    private static void output(String user, byte[] encoded) throws IOException
View Full Code Here

           oos.writeObject(obj);
           oos.close();
           zos.close();
           baos.close();
           Base64 base64Codec = new Base64();
           return new String(base64Codec.encode( baos.toByteArray() ), ZIP_CHARSET);
       }
       catch (IOException e)
       {
           log.fatal("Cannot encode Object with Base64", e);
           throw new FacesException(e);
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

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.