Here you can find the source of base64encode(String text)
Parameter | Description |
---|---|
text | a parameter |
public static String base64encode(String text)
//package com.java2s; /*/*from w ww. j av a 2 s . c om*/ * Copyright (c) 2015. , Beaufort 8 * released under MIT License * http://opensource.org/licenses/MIT */ import sun.misc.BASE64Encoder; import java.io.UnsupportedEncodingException; public class Main { private static final String DEFAULT_ENCODING = "UTF-8"; private static BASE64Encoder enc = new BASE64Encoder(); /** * base64encode * * @param text * @return */ public static String base64encode(String text) { try { return enc.encode(text.getBytes(DEFAULT_ENCODING)); } catch (UnsupportedEncodingException e) { return null; } } }