public static void seek(DataInput stream, long pos) throws IOException {
    if (stream instanceof OffsetTrackingInputStream inputStream) {
      long current = inputStream.getOffset();
      if (current < pos) {
        inputStream.skipBytes((int)(pos - current));
      } else {
        throw new IOException(String.format("Cannot go backwards in OffsetTrackingInputStream: current offset %#010x, seek %#010x", current, pos));
      }
      return;
    }
    if (stream instanceof RandomAccessFile raf) {
      raf.seek(pos);
      return;
    }
    throw new IOException("OffsetTrackingInputStream or RandomAccessFile expected, got " + stream.getClass().getName());
  }
public static void seek(DataInput stream, long pos)