-
-
Save AeroNotix/eecf8d63aa307381bfff to your computer and use it in GitHub Desktop.
This file contains 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 split-byte-array [ba c] | |
(let [bit (conv/ubyte (first (.getBytes c)))] | |
(loop [bais (ByteArrayInputStream. ba) | |
curr [] | |
out []] | |
(let [c (.read bais)] | |
(if (= -1 c) | |
(conj out (int-seq-to-byte-array curr)) | |
(if (= c bit) | |
(recur bais [] (if (> (count curr) 0) | |
(conj out (int-seq-to-byte-array curr)) | |
out)) | |
(recur bais (conj curr c) out))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment