The following code :
(spit "/Users/nha/tmp/spit.txt" (.getBytes "hello"))
produces a file containing "[B@71e054bc", which is independent of the content ("hello" in this case) since this is the JVM representation of the address of a byte array.
However the following works (taken from this SO post):
(clojure.java.io/copy
(.getBytes "hello")
(java.io.File. "/Users/nha/tmp/spit.txt"))
And the file then contains the correct content "hello".
Why does spit
behave like this ? Is there a way to expand it's behaviour for bytes ?