@Test public void string_base64_decode_java_8() throws UnsupportedEncodingException { String encodedURL = "aHR0cDovL2xldmVsdXBsdW5jaC5jb20vZXhhbXBsZXMvP3Bhcm09VGhpcyBwYXJhbWV0ZXI="; byte[] decodedURLAsBytes = java.util.Base64.getDecoder().decode( encodedURL); String decodedURL = new String(decodedURLAsBytes, "utf-8"); assertEquals("http://leveluplunch.com/examples/?parm=This parameter", decodedURL); }
@Test public void string_base64_decode_apache() throws UnsupportedEncodingException { String encodedURL = "aHR0cDovL2xldmVsdXBsdW5jaC5jb20vZXhhbXBsZXMvP3Bhcm09VGhpcyBwYXJhbWV0ZXI="; byte[] decodedURLAsBytes = Base64.decodeBase64(encodedURL); String decodedURL = new String(decodedURLAsBytes, "utf-8"); assertEquals( "http://leveluplunch.com/examples/?parm=This parameter", decodedURL); }