code: private int findImageVersion(DataInputStream in) throws IOException {
      in.mark(42); // arbitrary amount, resetting immediately
  
      int version = in.readInt();
      in.reset();
  
      return version;
    }
docs: Check an fsimage datainputstream's version number.
  
  The datainput stream is returned at the same point as it was passed in;
  this method has no effect on the datainputstream's read pointer.
  
  @param in Datainputstream of fsimage
  @return Filesystem layout version of fsimage represented by stream
  @throws IOException If problem reading from in