문제

I'm not able to convert hexadecimal value to base64 format using:

public static Writable encodeHex(Byte[] data)

Is there any sample code to convert into base64?

도움이 되었습니까?

해결책

--- EDIT ---

So for Groovy, apparently this is so simple :

String encoded = s.bytes.encodeBase64().toString()

References :

--- END EDIT ---

Since Java 8, there are Encoder / Decoder included in the API for Base64.

See the javadoc (JSE 8) :

And this article : Base64 Encoding in Java 8.

There's also a paragraph about that in Java 8 Friday: Let’s Deprecate Those Legacy Libs.

But if unfortunately like 99% of the people you don't use Java 8 yet, there are another libs :

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top