Rework ByteBuffer support.

ByteBuffer compression/decompression now only works on top of the ByteBuffer
API and does not try to read memory directly.