[英]Using Apache Commons Codec decodeBase64 from Clojure
I am trying to decode a base64 string in Clojure using the Apache Commons Codec library. 我正在尝试使用Apache Commons Codec库在Clojure中解码base64字符串。
I am able to use these methods in the library: 我可以在库中使用以下方法:
(ns decode.core
(:import (org.apache.commons.codec.binary Base64 Hex))
(:gen-class))
(.encode (Hex.) "s")
(.decode (Hex.) "0a")
(.decode (Base64.) "s")
But when I try to use decodeBase64
like (.decodeBase64 (Base64.) "s")
I get 但是,当我尝试使用
decodeBase64
像(.decodeBase64 (Base64.) "s")
我得到
IllegalArgumentException No matching method found: decodeBase64 for class
org.apache.commons.codec.binary.Base64 clojure.lang.Reflector.invokeMatchingMethod
(Reflector.java:53)
What am I doing wrong? 我究竟做错了什么? It seems like I should be able to call
decodeBase64
just like I can call decode
? 好像我应该能够调用
decodeBase64
一样,就像我可以调用decode
?
decodeBase64 is a static java method. encodeBase64是静态Java方法。 Here is how you call it in Clojure:
这是您在Clojure中的称呼方式:
(import '[org.apache.commons.codec.binary Base64 Hex])
(Base64/decodeBase64 "s")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.