Here you can find the source of byteToBase64(byte[] data)
Parameter | Description |
---|---|
data | byte[] |
Parameter | Description |
---|---|
IOException | an exception |
public static String byteToBase64(byte[] data)
//package com.java2s; //License from project: Apache License import java.util.Base64; public class Main { /**// w w w .ja v a2 s. c om * From a byte[] returns a base 64 representation * @param data byte[] * @return String * @throws IOException */ public static String byteToBase64(byte[] data) { //BASE64Encoder encoder = new BASE64Encoder(); //return encoder.encode(data); return Base64.getEncoder().encodeToString(data); } }