Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(bs/to-byte-array []) fails #19

Open
martinraison opened this issue Aug 13, 2015 · 2 comments
Open

(bs/to-byte-array []) fails #19

martinraison opened this issue Aug 13, 2015 · 2 comments

Comments

@martinraison
Copy link

Is this by design? I would expect to get an empty byte array instead.

=> (bs/to-byte-array [])
IllegalArgumentException Don't know how to convert class clojure.lang.PersistentVector into class [B byte-streams/convert (byte_streams.clj:187)

Since (bs/to-byte-array [(byte-array [2 3 4]) (byte-array [5 6])]) works, the behavior seems surprising to me. It requires checking that the array is not empty before calling to-byte-array.

@ztellman
Copy link
Collaborator

Currently byte-streams doesn't handle nil or empty sequences, mostly because I haven't thought through all the implications of (for instance) implicitly transforming nil into an empty byte-array. I agree, though, that it puts an unfortunate burden on you. Leaving this issue open until I have a better answer.

@martinraison
Copy link
Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants