Base64编译代码

package org.agilecentury.mail;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import sun.misc.BASE64Encoder;

/**
 * Base64编码工具类
 * @author yanxiaojia
 * @date 2012-3-12
 * 
 */
public class Base64Utill {
	public static void main(String[] args) throws Exception{
		BASE64Encoder encoder = new BASE64Encoder();
		System.out.println("please input user name:");
		String username = new BufferedReader(
					new InputStreamReader(System.in))
					.readLine();
		System.out.println(encoder.encode(username.getBytes()));
		System.out.println("please input password:");
		String password = new BufferedReader(
				new InputStreamReader(System.in))
				.readLine();		
		System.out.println(encoder.encode(password.getBytes()));
	}
}

你可能感兴趣的:(base64)