0

I am trying to decode a base64 string in Clojure using the Apache Commons Codec library.

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

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?

1 Answer 1

4

decodeBase64 is a static java method. Here is how you call it in Clojure:

 (import '[org.apache.commons.codec.binary Base64 Hex])
 (Base64/decodeBase64 "s")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.