Quantcast
Channel: Decoding a Base64 string in Java - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Decoding a Base64 string in Java

$
0
0

I'm trying to decode a simple Base64 string, but am unable to do so. I'm currently using the org.apache.commons.codec.binary.Base64 package.

The test string I'm using is: abcdefg, encoded using PHP YWJjZGVmZw==.

This is the code I'm currently using:

Base64 decoder = new Base64();
byte[] decodedBytes = decoder.decode("YWJjZGVmZw==");
System.out.println(new String(decodedBytes) + "\n") ;   

The above code does not throw an error, but instead doesn't output the decoded string as expected.


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images