Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java equivalent of Convert.FromBase64String Method

Is there some Java equivalent of Convert.FromBase64String which

Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.

I have tried:

  • com.lutris.util.Convert. but it gives me signed values
  • encode to string then convert to unsigned bytes, but then it gives me completely wrong output (wrong length and data).

Will be grateful for any suggestions!

like image 522
Maksym Gontar Avatar asked Sep 06 '25 19:09

Maksym Gontar


1 Answers

In general, chances are good that if the standard Java libraries don't have something you need, the Apache Commons framework does. In this case, you want the decodeBase64 method from commons.codec.binary.Base64.

like image 113
John Feminella Avatar answered Sep 10 '25 04:09

John Feminella