Fill in ByteBuffer API. Completely untested