ByteBufferInput/Output refactoring.