new binary IO interfaces

ready for code review and merge.