[英]Using Apache Commons Codec decodeBase64 from Clojure
我正在嘗試使用Apache Commons Codec庫在Clojure中解碼base64字符串。
我可以在庫中使用以下方法:
(ns decode.core
(:import (org.apache.commons.codec.binary Base64 Hex))
(:gen-class))
(.encode (Hex.) "s")
(.decode (Hex.) "0a")
(.decode (Base64.) "s")
但是,當我嘗試使用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)
我究竟做錯了什么? 好像我應該能夠調用decodeBase64
一樣,就像我可以調用decode
?
encodeBase64是靜態Java方法。 這是您在Clojure中的稱呼方式:
(import '[org.apache.commons.codec.binary Base64 Hex])
(Base64/decodeBase64 "s")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.