taoensso / nippy

The fastest serialization library for Clojure
https://www.taoensso.com/nippy
Eclipse Public License 1.0
1.04k stars 60 forks source link

Support for reading from a DataInput #19

Closed aphyr closed 11 years ago

aphyr commented 11 years ago

I'd like to use Nippy in a little Netty project I'm working on, and Netty exposes ByteBufInputStreams which act as both InputStream and DataInput. It'd be nice to avoid an extra byte[] copy by reading directly from a DataInput, and I think all the calls in thaw-from-stream could take that type instead. Then I'd just need to make thaw-from-stream publically accessible, or extend (thaw) to accept streams as well as byte arrays. Thoughts?

ptaoussanis commented 11 years ago

Hi Kyle,

Easiest would probably be to just make thaw-from-stream public. Note that none of the header+compression+encryption stuff is designed to operate with streams, so you'll need to use freeze with {:legacy-mode true :compressor nil :encryptor nil}. In that case you may just want to make freeze-to-stream public and use that too.

Actually, am considering making both of these public soon anyway for stream users.

Feel free to get in touch if you run into any issues. Cheers! :-)

ptaoussanis commented 11 years ago

Pushed to dev branch: https://github.com/ptaoussanis/nippy/commit/96097b8ad0ccf7856f39afd47efe217d93076788

ptaoussanis commented 11 years ago

freeze-to-stream and thaw-from-stream are both public as of v2.1.0. Feel free to reopen if you still have any issues.