Skip to content

Commit c7f339c

Browse files
committed
Replace commons-codec with java.util.Base64
1 parent 87a58ae commit c7f339c

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

project.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
:url "https://github.com/ring-clojure/ring-codec"
44
:license {:name "The MIT License"
55
:url "http://opensource.org/licenses/MIT"}
6-
:dependencies [[org.clojure/clojure "1.5.1"]
7-
[commons-codec "1.15"]]
6+
:dependencies [[org.clojure/clojure "1.5.1"]]
87
:plugins [[lein-codox "0.10.7"]]
98
:codox
109
{:output-path "codox"

src/ring/util/codec.clj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
(ns ring.util.codec
22
"Functions for encoding and decoding data."
33
(:require [clojure.string :as str])
4-
(:import java.io.File
5-
java.util.Map
4+
(:import java.util.Map
65
[java.net URLEncoder URLDecoder]
7-
org.apache.commons.codec.binary.Base64))
6+
[java.util Base64]))
87

98
(defn assoc-conj
109
"Associate a key with a value in a map. If the key already exists in the map,
@@ -79,12 +78,12 @@
7978
(defn base64-encode
8079
"Encode an array of bytes into a base64 encoded string."
8180
[unencoded]
82-
(String. (Base64/encodeBase64 unencoded)))
81+
(String. (.encode (Base64/getEncoder) unencoded)))
8382

8483
(defn base64-decode
8584
"Decode a base64 encoded string into an array of bytes."
8685
[^String encoded]
87-
(Base64/decodeBase64 (.getBytes encoded)))
86+
(.decode (Base64/getDecoder) encoded))
8887

8988
(defprotocol ^:no-doc FormEncodeable
9089
(form-encode* [x encoding]))

0 commit comments

Comments
 (0)