Last active
July 31, 2023 09:57
-
-
Save igrishaev/40b95ca99e859776daf61a8f045b5567 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn gipz-encode ^bytes [^bytes input] | |
(let [in | |
(new ByteArrayInputStream input) | |
out-bytes | |
(new ByteArrayOutputStream) | |
out-gzip | |
(new GZIPOutputStream out-bytes true) | |
buf | |
(byte-array 1024)] | |
(loop [] | |
(let [len (.read in buf)] | |
(when (> len 0) | |
(.write out-gzip buf 0 len) | |
(recur)))) | |
(.toByteArray out-bytes))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment