Package com.ibm.commons.util.io.base64

Examples of com.ibm.commons.util.io.base64.Base64InputStream


        }
       
        try {
            byte[] base64 = cyphertext.getBytes("ASCII"); //$NON-NLS-1$
            ByteArrayInputStream bin = new ByteArrayInputStream(base64);
            Base64InputStream base64in = new Base64InputStream(bin);
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            byte[] barr = new byte[cyphertext.length()];
            while(true) {
                int r = base64in.read(barr);
                if(r<=0) break;
                buffer.write(barr, 0, r);
            }
            byte[] encrypted = buffer.toByteArray();
            byte[] plaintext = decrypt(key, encrypted);
View Full Code Here


       
        try {
            byte[] data = plaintext.getBytes("UTF-8"); //$NON-NLS-1$
            byte[] cyphertext = encrypt(key, data);
            ByteArrayOutputStream barrout = new ByteArrayOutputStream(cyphertext.length*3/2);
            Base64OutputStream base64 = new Base64OutputStream(barrout);
            base64.write(cyphertext);
            base64.flush();
            barrout.flush();
            //Base64 is ASCII safe
            String ret = barrout.toString("ASCII"); //$NON-NLS-1$
            return ret;
        } catch(IOException e) {
View Full Code Here

    if (o instanceof Node)
      return serialize((Node) o);
    if (o instanceof Header[])
      return serialize((Header[]) o);
    ByteArrayOutputStream w = new ByteArrayOutputStream();
    Base64OutputStream base64OutputStream = new Base64OutputStream(w);
    ObjectOutputStream os = new ObjectOutputStream(base64OutputStream);
    os.writeObject(o);
    os.flush();
    os.close();
    base64OutputStream.flush();
    base64OutputStream.close();
    return w.toString("UTF-8");
  }
View Full Code Here

TOP

Related Classes of com.ibm.commons.util.io.base64.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.