Package com.github.stephenc.javaisotools.iso9660.impl

Examples of com.github.stephenc.javaisotools.iso9660.impl.CreateISOTest


        // 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

        os = new FileOutputStream(contentsB);
        IOUtil.copy("Goodbye", os);
        IOUtil.close(os);

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

        StreamHandler streamHandler = new ISOImageFileHandler(outfile);
        CreateISO iso = new CreateISO(streamHandler, root);
View Full Code Here

      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);
      ISO9660File file10 = new ISO9660File("test/tux.gif", 10);
      root.addFile(file10);
      ISO9660File file12 = new ISO9660File("test/tux.gif", 12);
      root.addFile(file12);
    }

    // ISO9660 support
    ISO9660Config iso9660Config = new ISO9660Config();
View Full Code Here

            // Replace original file by patched one
            orgFile.delete();
            orgFile = new File(orgName);
            patchedFile.renameTo(orgFile);
            config.setBootImage(new ISO9660File(orgFile));

            System.out.println("Patched boot image at " + orgFile.getPath());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
View Full Code Here

    public ElToritoConfig(File bootImage, int emulation, int platformID, String idString, int sectorCount,
                          int loadSegment) throws HandlerException, ConfigException {
        super("EL TORITO SPECIFICATION", "");
        this.bootable = true;
        this.loadSegment = loadSegment;
        this.bootImage = new ISO9660File(bootImage);
        setIDString(idString);
        this.systemType = 0;
        this.sectorCount = sectorCount;
        setPlatformID(platformID);
        setEmulation(emulation);
View Full Code Here

          }

          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);
View Full Code Here

            id = (String) object;
            bytes = helper.pad(id, 128);
        } else if (object instanceof ISO9660File) {
            ByteBuffer buf = ByteBuffer.allocate(128);
            buf.put((byte) 0x5F);
            ISO9660File file = (ISO9660File) object;
            file.enforce8plus3(true);
            id = helper.getFilenameDataReference(file).getName();
            buf.put(helper.pad(id, 127));
            bytes = buf.array();
        } else {
            throw new HandlerException(
View Full Code Here

        // Root files (root itself does not have to be mapped)
        Iterator isoFit = isoRoot.getFiles().iterator();
        Iterator rripFit = rripRoot.getFiles().iterator();
        while (isoFit.hasNext()) {
            ISO9660File isoFile = (ISO9660File) isoFit.next();
            ISO9660File rripFile = (ISO9660File) rripFit.next();
            fileMapper.put(isoFile, rripFile);
        }

        // Subdirectories:
        // Since rripRoot and isoRoot are just a deep copy of the same
        // root at this point, simultaneous iteration can be applied here
        Iterator isoIt = isoRoot.unsortedIterator();
        Iterator rripIt = rripRoot.unsortedIterator();
        while (isoIt.hasNext()) {
            ISO9660Directory isoDir = (ISO9660Directory) isoIt.next();
            ISO9660Directory rripDir = (ISO9660Directory) rripIt.next();
            directoryMapper.put(isoDir.getID(), rripDir);

            isoFit = isoDir.getFiles().iterator();
            rripFit = rripDir.getFiles().iterator();
            while (isoFit.hasNext()) {
                ISO9660File isoFile = (ISO9660File) isoFit.next();
                ISO9660File rripFile = (ISO9660File) rripFit.next();
                fileMapper.put(isoFile.getID(), rripFile);
            }
        }
    }
View Full Code Here

    // Output file
    File outfile = new File(args.length>0 ? args[0] : "ISOTest.iso");

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

    if (args.length>1) {
      // Record specified files and directories

      for (int i=1; i<args.length; i++) {
        if (args[i].startsWith("--")) {
          handleOption(args[i].substring(2, args[i].length()));
        } else {
          // Add file or directory contents recursively
          File file = new File(args[i]);
          if (file.exists()) {
            if (file.isDirectory()) {
              root.addContentsRecursively(file);
            } else {
              root.addFile(file);
            }
          }
        }
      }
    } else {
      // Record test cases

      // Very long filename: a...z
      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);
      ISO9660File file10 = new ISO9660File("test/tux.gif", 10);
      root.addFile(file10);
      ISO9660File file12 = new ISO9660File("test/tux.gif", 12);
      root.addFile(file12);
    }

    // ISO9660 support
    ISO9660Config iso9660Config = new ISO9660Config();
    iso9660Config.allowASCII(false);
View Full Code Here

TOP

Related Classes of com.github.stephenc.javaisotools.iso9660.impl.CreateISOTest

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.