binyo offers a generic C API for dealing with Ruby IO objects and extension classes that allow to deal effectively with binary data
Martin Bosslet
MIT