Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created May 31, 2011 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/1001356 to your computer and use it in GitHub Desktop.
Save amalloy/1001356 to your computer and use it in GitHub Desktop.
foreclojure.core> (def out (ByteArrayOutputStream.))
#'foreclojure.core/out
foreclojure.core> (.write out 10)
nil
foreclojure.core> (.write out -1)
nil
foreclojure.core> (def in (ByteArrayInputStream. (.toByteArray out)))
#'foreclojure.core/in
foreclojure.core> (.read in)
10
foreclojure.core> (.read in)
255
foreclojure.core> (.read in)
-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment