Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2012  |  syntax: None  |  size: 0.33 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. foreclojure.core> (def out (ByteArrayOutputStream.))
  2. #'foreclojure.core/out
  3. foreclojure.core> (.write out 10)
  4. nil
  5. foreclojure.core> (.write out -1)
  6. nil
  7. foreclojure.core> (def in (ByteArrayInputStream. (.toByteArray out)))
  8. #'foreclojure.core/in
  9. foreclojure.core> (.read in)
  10. 10
  11. foreclojure.core> (.read in)
  12. 255
  13. foreclojure.core> (.read in)
  14. -1