code: public void seek(long pos) throws IOException
      {
          long inSegmentPos = pos - segmentOffset;
          if (inSegmentPos < 0 || inSegmentPos > buffer.capacity())
              throw new IOException(String.format("Seek position %d is not within mmap segment (seg offs: %d, length: %d)", pos, segmentOffset, buffer.capacity()));
  
          seekInternal((int) inSegmentPos);
      }
docs: IOException otherwise.