code: public void writeIfds() throws IOException {
      IFD first = model.getFirstIFD();
      IFD current = first;
  
      if (current != null) {
        // First IFD offset
        data.putInt((int) data.position() + 4);
      }
  
      while (current != null) {
        writeIFD(current);
        current = current.getNextIFD();
      }
    }
docs: Write.
  
  @throws IOException Signals that an I/O exception has occurred.