Clojure base64 编码 [英] Clojure base64 encoding

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

问题描述

我想要像字符串"这样简单的东西 -> 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

推荐答案

您可以使用 编码函数并传递字节数组:

You can use encode function and pass array of bytes:

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

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

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