Here you can find the source of encodeString(String b)
public static String encodeString(String b) throws Exception
//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(); } }