I am trying to convert byte array to base64 format in java.
my problem is sun.misc.BASE64Decoder cannot be used? Is there any alternative?
byte[] buf = new byte[] { 0x12, 0x23 };
String s = new sun.misc.BASE64Encoder().encode(buf);
I am trying to convert byte array to base64 format in java.
my problem is sun.misc.BASE64Decoder cannot be used? Is there any alternative?
byte[] buf = new byte[] { 0x12, 0x23 };
String s = new sun.misc.BASE64Encoder().encode(buf);
I would recommend using this library: MigBase64
Use it like this:
byte [] buf = new byte[]{0x12, 0x23};
String s = Base64.encode(buf);
Base64 is not an encryption technique. It is just an encoding mechanism. If you're looking for enryption you're barking up the wrong tree.
import sun.misc.BASE64Decoder
is not a 'header file', it is an import statement. It may not compile if you are using a non-Sun/Oracle JDK. It may give you warnings which you should heed. As you haven't actually said what problem you are having it is impossible to comment further.