@Override
  public void seek(long newPos) {
    if (newPos < 0) {
      throw new IllegalArgumentException("New position cannot be negative");
    }
    if (newPos == 0) {
      _currentPage = _pages.get(0);
      _offsetInPage = 0;
    } else {
      int pageIdx = (int) (newPos / _pageSize);
      if (pageIdx >= _pages.size()) {
        _pages.ensureCapacity(pageIdx + 1);
        while (_pages.size() <= pageIdx) {
          _pages.add(_allocator.allocate().order(ByteOrder.BIG_ENDIAN));
        }
      }
      int offsetInPage = (int) (newPos % _pageSize);
      _currentPage = _pages.get(pageIdx);
      _currentPageStartOffset = pageIdx * (long) _pageSize;
      _offsetInPage = offsetInPage;
    }
    _written = Math.max(_written, newPos);
  }
@Test
  void seekIntoNegative() {
    assertThrows(IllegalArgumentException.class, () -> _pagedPinotOutputStream.seek(-1));
  }