Package org.jnode.fs.iso9660

Examples of org.jnode.fs.iso9660.ISO9660Directory


      root.addDirectory("a1234567890b1234567890c1234567890d1234567890e1234567890f1234567890g1234567890h1234567890i1234567890j1234567890k1234567890l1234567890m1234567890n1234567890o1234567890p1234567890q1234567890r1234567890s1234567890t1234567890u1234567890v1234567890w1234567890x1234567890y1234567890z");
      // German Umlauts
      root.addDirectory("äöüÄÖÜß");

      // Filenames that will have to be renamed (count test)
      ISO9660Directory dir_1 = root.addDirectory("1");
      dir_1.addDirectory("1");
      dir_1.addDirectory("1");

      ISO9660Directory dir_a = root.addDirectory("a");
      dir_a.addDirectory("a");
      dir_a.addDirectory("a");

      ISO9660Directory dir_abcdefg = root.addDirectory("abcdefg");
      dir_abcdefg.addDirectory("abcdefg");
      dir_abcdefg.addDirectory("abcdefg");

      ISO9660Directory dir_abcdefgh = root.addDirectory("abcdefgh");
      dir_abcdefgh.addDirectory("abcdefgh");
      dir_abcdefgh.addDirectory("abcdefgh");

      ISO9660Directory dir_abcde321 = root.addDirectory("abcde321");
      dir_abcde321.addDirectory("abcde321");
      dir_abcde321.addDirectory("abcde321");

      // Additional test cases
      // (file without extension, tar.gz, deeply nested directory;
      // sort order tests, renaming tests: filename + extension,
      // directory with many files: sector end test)
      root.addRecursively(new File("test"));

      // Dirs to appear in order A, B, Aeins, Azwei, Cubase, Beins, Bzwei
      ISO9660Directory subdirA = root.addDirectory("A");
      subdirA.addDirectory("Aeins");
      subdirA.addDirectory("Azwei");
      ISO9660Directory subdirB = root.addDirectory("B");
      subdirB.addDirectory("Bzwei");
      subdirB.addDirectory("Beins");

      // Files with different versions
      // (to appear in descending order, pointing to same LSN)
      ISO9660File file1 = new ISO9660File("test/tux.gif", 1);
      root.addFile(file1);
View Full Code Here


      for (ResourceIterator i = getResources(); i.hasNext();) {
        ArchiveEntry entry = i.next();

        switch (entry.getType()) {
        case ArchiveEntry.DIRECTORY: {
          ISO9660Directory dir;

          dir = new ISO9660Directory(getName(entry));

          directories.put(getPath(entry), dir);

          String path = getPath(entry);
          while ((path = getParentPath(path)) != "") {
            dir = new ISO9660Directory(getName(path));
            directories.put(path, dir);
          }

          break;
        }
        case ArchiveEntry.FILE: {
          ISO9660File file;
          ISO9660Directory dir;

          /* Create the file */
          file = new ISO9660File(
              new ArchiveEntryDataReference(entry),
              getName(entry), entry.getResource()
                  .getLastModified());

          files.put(getPath(entry), file);

          String path = getPath(entry);
          while ((path = getParentPath(path)) != "") {
            dir = new ISO9660Directory(getName(path));
            directories.put(path, dir);
          }

          break;
        }
        default:
          throw new Iso9660ArchiverException(
              Type.UnsupportedEntryType, "Unknown entry type");
        }
      }

      /* Attache children to their parents */
      for (Map.Entry<String, ISO9660Directory> e : directories.entrySet()) {
        if (!e.getKey().equals("")) {
          ISO9660Directory parent = directories.get(getParentPath(e
              .getKey()));
          parent.addDirectory(e.getValue());
        }
      }

      for (Map.Entry<String, ISO9660File> e : files.entrySet()) {
        ISO9660Directory parent = directories.get(getParentPath(e
            .getKey()));
        parent.addFile(e.getValue());
      }

      StreamHandler streamHandler = new ISOImageFileHandler(new File(
          dest.getParentFile(), dest.getName()));
      CreateISO iso = new CreateISO(streamHandler, root);
View Full Code Here

        }

        // Add files
        String[] files = ds.getIncludedFiles();
        for (int i = 0; i < files.length; i++) {
            ISO9660Directory dir = root;
            String path = checkPrefix(files[i], prefix);
            if (path.indexOf(File.separator) >= 0) {
                path = path.substring(0, path.lastIndexOf(File.separator));
                dir = root.addPath(path);
            }
            dir.addFile(new File(ds.getBasedir(), files[i]));
        }
    }
View Full Code Here

    private void doFCA() throws HandlerException {
        doFCADirs(root);

        Iterator<ISO9660Directory> it = root.sortedIterator();
        while (it.hasNext()) {
            ISO9660Directory dir = it.next();
            doFCADirs(dir);
        }
    }
View Full Code Here

        NamingConventions namingConventions = helper.getNamingConventions();
        namingConventions.processDirectory(rripRoot);

        Iterator sit = rripRoot.unsortedIterator();
        while (sit.hasNext()) {
            ISO9660Directory dir = (ISO9660Directory) sit.next();
            namingConventions.processDirectory(dir);
        }
    }
View Full Code Here

        super.relocateDirectories();
    }

    ISO9660Directory relocate(ISO9660Directory dir) {
        ISO9660Directory originalParent = super.relocate(dir);

        helper.matchDirectory(dir).relocate();

        if (dir.getRoot() == root) {
            // Save only mappings from ISO 9660 hierarchy
View Full Code Here

    }

    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 = new POSIXFileMode();
        fileMode.setDefault(true);
        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));
    }
View Full Code Here

    }

    private void doRelocationFixups(HashMap fixups, HashMap locations) throws HandlerException {
        Iterator it = fixups.keySet().iterator();
        while (it.hasNext()) {
            ISO9660Directory dir = (ISO9660Directory) it.next();

            // Write and close Location Fixup
            Fixup locationFixup = (Fixup) fixups.get(dir);
            int location = ((Integer) locations.get(dir)).intValue();
            locationFixup.data(new BothWordDataReference(location));
View Full Code Here

        // Directory hierarchy, starting from the root
        ISO9660RootDirectory.MOVED_DIRECTORIES_STORE_NAME = "rr_moved";
        ISO9660RootDirectory root = new ISO9660RootDirectory();

        ISO9660Directory dir = root.addDirectory("root");
        dir.addFile(contentsA);
        dir.addFile(contentsB);

        StreamHandler streamHandler = new ISOImageFileHandler(outfile);
        CreateISO iso = new CreateISO(streamHandler, root);
        ISO9660Config iso9660Config = new ISO9660Config();
        iso9660Config.allowASCII(false);
View Full Code Here

        IOUtil.copy("Goodbye", os);
        IOUtil.close(os);

        // Top down
        ISO9660RootDirectory root = new ISO9660RootDirectory();
        ISO9660Directory n1 = root.addDirectory("D1");
        ISO9660Directory n2 = n1.addDirectory("D2");
        ISO9660Directory n3 = n2.addDirectory("D3");
        n3.addFile(contentsA);
        n3.addFile(contentsB);

        StreamHandler streamHandler = new ISOImageFileHandler(outfile);
        CreateISO iso = new CreateISO(streamHandler, root);
        ISO9660Config iso9660Config = new ISO9660Config();
        iso9660Config.allowASCII(false);
View Full Code Here

TOP

Related Classes of org.jnode.fs.iso9660.ISO9660Directory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.