Clojure base64编码 [英] Clojure base64 encoding
本文介绍了Clojure base64编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
clojure.data.codec.base64
需要输入和输出流,似乎所以,有一个字符串,得到一个base64编码数组的方式是什么?谢谢解决方案
您可以使用 encode 函数并传递字节数组:
(encode(.getBytesHello world!))
I want something as simple as "string" -> base64. With the older base64.encode-str it was easy (and sounded "more clojure", but the newer clojure.data.codec.base64
requires input and output streams and seems an ugly wrapper around Java way of doing things.
So, what is the way, having a string, to get a base64 encoded array? Thanks
解决方案
You can use encode function and pass array of bytes:
(encode (.getBytes "Hello world!"))
这篇关于Clojure base64编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文