HashMap doDotDotDR(ISO9660Directory dir) throws HandlerException {
    long position = streamHandler.mark();
    HashMap memory = super.doDotDotDR(dir);
    ISO9660Directory parentDir = dir.getParentDirectory();

    if (RRIPFactory.MKISOFS_COMPATIBILITY) {
      // RR: Recorded Fields
      int flags = RRIPFactory.RR_PX_RECORDED | RRIPFactory.RR_TF_RECORDED;
      if (dir.isMoved()) {
        flags |= RRIPFactory.RR_PL_RECORDED;
      }
      rripFactory.doRREntry(flags);
    }

    if (dir.isMoved()) {
      // PL: Real Parent of this relocated directory
      parentLocationFixups.put(dir, rripFactory.doPLEntry());
    }

    // PX: POSIX File Attributes
    POSIXFileMode fileMode = getPOSIXFileModeForObject(dir);
    int fileModes = fileMode.getFileMode();
    int fileLinks = 2 + parentDir.getDirectories().size();
    rripFactory.doPXEntry(fileModes, fileLinks, 0, 0, 1);

    // TF: Timestamp
    ISO9660ShortDateDataReference date =
        new ISO9660ShortDateDataReference(parentDir.lastModified());
    rripFactory.doTFEntry(RRIPFactory.TF_MODIFY, date);

    // Update Directory Record Length
    return finalizeDR(memory, helper.getDifferenceTo(position));
  }
  void doDir(ISO9660Directory dir, HashMap parentMapper) throws HandlerException {
    Integer location = new Integer(helper.getCurrentLocation());

    if (originalParentMapper.containsKey(dir)) {
      // Remember directory location for PL Location Fixup
      parentLocations.put(originalParentMapper.get(dir), location);
    } else if (dir.isMoved()) {
      // Remember directory location for CL Location Fixup
      childLocations.put(dir, location);
    }

    super.doDir(dir, parentMapper);
  }
  HashMap doDR(ISO9660Directory dir) throws HandlerException {
    long position = streamHandler.mark();
    HashMap memory = super.doDR(dir);

    if (RRIPFactory.MKISOFS_COMPATIBILITY) {
      // RR: Recorded Fields
      int flags =
          RRIPFactory.RR_PX_RECORDED | RRIPFactory.RR_TF_RECORDED | RRIPFactory.RR_NM_RECORDED;
      if (dir.isMoved()) {
        flags |= RRIPFactory.RR_RE_RECORDED;
      }
      rripFactory.doRREntry(flags);
    }

    if (dir.isMoved()) {
      // RE: Directory has been relocated (moved)
      rripFactory.doREEntry();
    }

    // PX: POSIX File Attributes
    POSIXFileMode fileMode = getPOSIXFileModeForObject(dir);
    int fileModes = fileMode.getFileMode();
    int fileLinks = 2 + dir.getDirectories().size();
    rripFactory.doPXEntry(fileModes, fileLinks, 0, 0, 1);

    // TF: Timestamp
    ISO9660ShortDateDataReference date = new ISO9660ShortDateDataReference(dir.lastModified());
    rripFactory.doTFEntry(RRIPFactory.TF_MODIFY, date);

    // Compute length up to here
    int length = helper.getDifferenceTo(position);

    // NM: Alternate Name
    length = doNM(helper.getFilenameDataReference(dir), length);

    // Update Directory Record Length
    return finalizeDR(memory, length);
  }