@Override
    public int remaining() {
      int header = readHeader();
      int allocatedCursor = unpackAllocatedCursor(header);
      return capacity() - allocatedCursor;
    }
@Override
    public int remaining()