Skip to content

Instantly share code, notes, and snippets.

@AdamClements
Created May 7, 2014 16:00
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 AdamClements/9441ad39254b91a8718b to your computer and use it in GitHub Desktop.
Save AdamClements/9441ad39254b91a8718b to your computer and use it in GitHub Desktop.
(defn dump [^ByteBuffer b]
(let [readcopy (.asReadOnlyBuffer b)]
(.rewind readcopy)
(for [i (range (/ (.limit readcopy) 4))]
(.getInt readcopy))))
(defmethod print-method ByteBuffer
[v ^java.io.Writer w]
(.write w (str "#<ByteBuffer" (pr-str (dump v)) ">")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment