Changed read(ByteBuffer) to perform some error checking.