Home
Cloud
Big Data
CI
Install
Samples
Java
Ubuntu
Maven
Archive
Java
|
Base64
Encode/Decode
Encode/Decode
import java.io.UnsupportedEncodingException; import java.util.Base64; public class Base64Test { public static void main(String[] args) throws UnsupportedEncodingException { final String value = "test"; final byte[] encodedValue = Base64.getEncoder().encode(value.getBytes("UTF-8")); final byte[] decodedValue = Base64.getDecoder().decode(encodedValue); // should print 'test'! System.out.println(new String(decodedValue, "UTF-8")); } }
© 2010-2022
mti
tek