public static long getOffset(DataInput stream) throws IOException {
    if (stream instanceof OffsetTrackingInputStream otis) return otis.getOffset();
    if (stream instanceof RandomAccessFile raf) return raf.getFilePointer();
    throw new IOException("OffsetTrackingInputStream or RandomAccessFile expected, got " + stream.getClass().getName());
  }
public static long getOffset(DataInput stream)