Skip to content

Instantly share code, notes, and snippets.

@jarohen
Last active June 12, 2019 12:44
Show Gist options
  • Save jarohen/37a33309cd982061c354f1aae0f7b589 to your computer and use it in GitHub Desktop.
Save jarohen/37a33309cd982061c354f1aae0f7b589 to your computer and use it in GitHub Desktop.
(let [bytes (with-open [os (java.io.ByteArrayOutputStream.)
oos (java.io.ObjectOutputStream. os)]
(.writeObject oos false)
(.toByteArray os))]
(with-open [is (java.io.ByteArrayInputStream. bytes)]
(if (.readObject (java.io.ObjectInputStream. is))
:truthy
:falsy))) ; => :truthy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment