Clojure base64编码 [英] Clojure base64 encoding

查看:219
本文介绍了Clojure base64编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个简单的例如string - > base64。使用较旧的base64.encode-str很容易(听起来更多clojure,但是更新的 clojure.data.codec.base64 需要输入和输出流,丑陋的环绕Java的做事方式。

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.

那么,有一个字符串,得到一个base64编码数组的方式是什么感谢

So, what is the way, having a string, to get a base64 encoded array? Thanks

推荐答案

您可以使用 encode function and pass array of bytes:

You can use encode function and pass array of bytes:

(encode (.getBytes "Hello world!"))

这篇关于Clojure base64编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆