Here you can find the source of base64Encoder(String str)
public static String base64Encoder(String str)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import sun.misc.BASE64Encoder; public class Main { public static String base64Encoder(String str) { byte[] b = null; String s = null;//from w w w . jav a 2s . c o m try { b = str.getBytes("utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } if (b != null) { s = new BASE64Encoder().encode(b); } return s; } }