Here you can find the source of base64encode(String decodedString)
Parameter | Description |
---|---|
decodedString | a parameter |
public static String base64encode(String decodedString)
//package com.java2s; //License from project: Open Source License import javax.xml.bind.DatatypeConverter; public class Main { /**/*from ww w. j a v a2 s . c om*/ * @param decodedString */ public static String base64encode(String decodedString) { return DatatypeConverter.printBase64Binary(decodedString.getBytes()); } /** * @param decodedString */ public static String base64encode(byte[] bytes) { return DatatypeConverter.printBase64Binary(bytes); } /** * Transform the length into the 32-bit message length. * * @param length * @return */ public static byte[] getBytes(int length) { byte[] bytes = new byte[4]; bytes[0] = (byte) (length & 0xFF); bytes[1] = (byte) ((length >> 8) & 0xFF); bytes[2] = (byte) ((length >> 16) & 0xFF); bytes[3] = (byte) ((length >> 24) & 0xFF); return bytes; } }