If I do this:
json-for-nlp (cheshire/generate-string map-for-nlp)
byte-array-json (.getBytes json-for-nlp)
I assume I now have an array of bytes. But if I do:
(.length byte-array-json)
I get:
No matching field found: length for class
Why is that?
More info below.
(let [config (read-string (slurp "/etc/ginger"))
api-sends-messages-to-nlp (BufferedOutputStream.
(FileOutputStream. (:api-sends-messages-to-nlp config)))
map-for-nlp (:document message)
json-for-nlp (cheshire/generate-string map-for-nlp)
byte-array-json (.getBytes json-for-nlp)
]
(timbre/log :trace (str " the type of byte-array-json " (type
byte-array-json)))
(timbre/log :trace (str " the class of byte-array-json " (class
byte-array-json)))
(timbre/log :trace (str " the json byte array: " byte-array-json))
(let [
length-of-byte-array-json (. byte-array-json length)
]
(.write api-sends-messages-to-nlp byte-array-json 0
length-of-byte-array-json )
(.flush api-sends-messages-to-nlp)
)
the length of the json byte array: [B@854db24
the type of byte-array-json class [B
the class of byte-array-json class [B
java.lang.IllegalArgumentException: No matching field found: length for
class [B
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.