clojure.core/bytes¶
Casts to bytes[]
Examples¶
Note by Brian Marick¶
Why is the (comp byte int) required in the example? This seems to work just as well:
user=> (def b (bytes (byte-array (map byte "ascii")))) user=> (String. b) "ascii"
Note by Brian Marick¶
For that matter, why is the bytes needed? Consider:
user=> (String. (byte-array (map byte "ascii"))) "ascii"
Note by xcthulhu¶
AFAIK, bytes is used for referring to bytes[].class from JAVA
Example (midje):
(fact (class (.getBytes "test")) => bytes) ; true
See also¶
Content from the matching ClojureDocs page, with authors credited on each contribution.