Java String Encode encodeString(String b)

Here you can find the source of encodeString(String b)

Description

encode String

License

Apache License

Declaration

public static String encodeString(String b) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayOutputStream;

import java.io.OutputStream;

import javax.mail.internet.MimeUtility;

public class Main {
    public static String encodeString(String b) throws Exception {
        return new String(encode(b.getBytes()));
    }/*  www . jav  a 2 s . com*/

    public static byte[] encode(byte[] b) throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OutputStream b64os = MimeUtility.encode(baos, "base64");
        b64os.write(b);
        b64os.close();
        return baos.toByteArray();
    }
}

Related

  1. encodeStr(String str)
  2. encodeStr(String str)
  3. encodeStr(String t)
  4. encodeString(final String string)
  5. encodeString(OutputStream out, String str)
  6. encodeString(String in)
  7. encodeString(String myString)
  8. encodeString(String s)
  9. encodeString(String s)