Creates name-version directory creates debian source files and runs
dpkg-buildpackage -us -uc
@param base
@return
@throws IOException
519312
@Override
    public Path build(Path base) throws IOException
    {
        this.dir = base.resolve(name+"-"+version);
        this.debian = dir.resolve("debian");
        control.setStandardsVersion(STANDARDS_VERSION);
        changeLog.set(name, version, release, maintainer);
        control.setSource(name);
        for (FileBuilder fb : fileBuilders)
        {
            fb.build();
        }
        copyright.save(debian);
        control.save(debian);

        changeLog.save(debian);
        // compat
        Path compat = debian.resolve("compat");
        try (BufferedWriter bf = Files.newBufferedWriter(compat, UTF_8))
        {
            bf.append(String.format("%d\n", compatibility));
        }
        for (MaintainerScript ms : maintainerScripts)
        {
            ms.save();
        }
        // rules
        Path rules = debian.resolve("rules");
        FileUtil.copyResource("/rules", rules, DEBBuilder.class);
        PosixHelp.setPermission(rules, "-rwxr-xr-x");
        // source/format
        Path source = debian.resolve("source");
        Files.createDirectories(source);
        Path format = source.resolve("format");
        try (BufferedWriter bf = Files.newBufferedWriter(format, UTF_8))
        {
            bf.append(SOURCE_FORMAT);
        }
        conffiles.save(debian);
        docs.save(debian);
        try
        {
            OSProcess.call(dir, null, "dpkg-buildpackage -us -uc");
        }
        catch (InterruptedException ex)
        {
            throw new IOException(ex);
        }
        return dir;
    }
9685
@Override
    public FatLfnDirectoryEntry addFile(String name) throws IOException {
        checkWritable();
        checkUniqueName(name);
        
        name = name.trim();
        final ShortName sn = makeShortName(name);
        
        final FatLfnDirectoryEntry entry =
                new FatLfnDirectoryEntry(name, sn, this, false);

        dir.addEntries(entry.compactForm());
        
        shortNameIndex.put(sn, entry);
        longNameIndex.put(name.toLowerCase(Locale.ROOT), entry);

        getFile(entry.realEntry);
        
        dir.setDirty();
        return entry;
    }
257560
NameWithINode getSourceFile(String parity, String prefix) throws IOException {
    if (isHarFile(parity)) {
      return null;
    }
    // remove the prefix
    String src = parity.substring(prefix.length());
    byte[][] components = INodeDirectory.getPathComponents(src);
    INode inode = namesystem.dir.getINode(components);
    return new NameWithINode(src, inode);
  }
1368886
public void copyLibraryFromPackage(String libraryName) throws IOException {
        Path ardDir = getArduinoDirectory().orElseThrow(IOException::new);
        Path source = Paths.get(embeddedDirectory).resolve(libraryName);

        Path dest = ardDir.resolve("libraries/" + libraryName);
        if(!Files.exists(dest)) {
            Files.createDirectory(dest);
        }

        Path gitRepoDir = dest.resolve(".git");
        if(Files.exists(gitRepoDir)) {
            throw new IOException("Git repository inside " + libraryName+ "! Not proceeding to update path : " + dest);
        }

        copyLibraryRecursive(source, dest);
    }
131369
private void createSystemFolder() throws IOException {
        if(!Files.exists(systemLocation.toPath()))
            Files.createDirectories(systemLocation.toPath());
    }
60909
static File createSegmentFile(String name, File directory, long id, long version) {
    return new File(directory, String.format("%s-%d-%d.log", Assert.notNull(name, "name"), id, version));
  }
695432
public static FileWriter createSrcFile(String name, String packageName, String outDir) throws IOException
   {
      String directory = "src" + File.separatorChar + "main" + File.separatorChar + "java";

      return createPackageFile(name, packageName, directory, outDir);
   }
1033496
public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage,
			String name) {
		JPropertyFile propertyFile = null;
		for (Iterator<JResourceFile> iterator = thePackage.propertyFiles(); iterator
				.hasNext() && (null == propertyFile);) {
			final JResourceFile resourceFile = (JResourceFile) iterator.next();
			if (resourceFile instanceof JPropertyFile
					&& name.equals(resourceFile.name())) {
				propertyFile = (JPropertyFile) resourceFile;
			}
		}

		if (null == propertyFile) {
			propertyFile = new JPropertyFile(name);
			thePackage.addResourceFile(propertyFile);
		}
		return propertyFile;
	}
1292846
@Override
    public FileSystem newFileSystem(final URI uri, final Map<String, ?> env) throws IOException {

        // Precondition checks
        if (uri == null) {
            throw new IllegalArgumentException("URI must be specified");
        }
        if (env == null) {
            throw new IllegalArgumentException("Environment must be specified");
        }

        // Scheme is correct?
        final String scheme = uri.getScheme();
        if (!scheme.equals(SCHEME)) {
            throw new IllegalArgumentException(ShrinkWrapFileSystem.class.getSimpleName()
                + " supports URI with scheme " + SCHEME + " only.");
        }

        // Get ID of the archive
        final String id = uri.getHost();

        // Archive is provided?
        Archive<?> archive = null;
        final Object archiveArg = env.get(ENV_KEY_ARCHIVE);
        if (archiveArg != null) {
            try {
                archive = Archive.class.cast(archiveArg);
                // Ensure the name of the archive matches the host specified in the URI
                if (!archive.getId().equals(id)) {
                    throw new IllegalArgumentException("Specified archive " + archive.toString()
                        + " does not have name matching the host of specified URI: " + uri.toString());
                }
                if (log.isLoggable(Level.FINER)) {
                    log.finer("Found archive supplied by environment: " + archive.toString());
                }
            } catch (final ClassCastException cce) {
                // User specified the wrong type, translate and rethrow
                throw new IllegalArgumentException("Unexpected argument passed into environment under key "
                    + ENV_KEY_ARCHIVE + ": " + archiveArg);
            }
        }
        // If archive could not be found in the environment, IllegalArgumentException
        if (archive == null) {
            throw new IllegalArgumentException("archive must be specified in the environment under key " + ENV_KEY_ARCHIVE);
        }

        // Lock for compound operations on createdFileSystems
        createNewFsLock.lock();

        // Exists?
        final ShrinkWrapFileSystem existsFs = this.createdFileSystems.get(archive.getId());
        if (existsFs != null && existsFs.isOpen()) {
            throw new FileSystemAlreadyExistsException("File System for URI " + uri.toString() + " already exists: "
                + existsFs.toString());
        } else if (existsFs != null && !existsFs.isOpen()) {
            if (log.isLoggable(Level.FINE)) {
                log.fine("Attempting to create a file system for URI " + uri.toString()
                    + ", and one has been made but is closed; it will be replaced by a new one.");
            }
        }

        // Make a new FileSystem
        final ShrinkWrapFileSystem newFs = new ShrinkWrapFileSystem(this, archive);
        if (log.isLoggable(Level.FINE)) {
            log.fine("Created new filesystem: " + newFs.toString() + " for URI " + uri.toString());
        }
        this.createdFileSystems.put(archive.getId(), newFs);

        // Unlock, compound operations done on createdFileSystems
        createNewFsLock.unlock();

        // Return
        return newFs;
    }
1219268
public static Map<String, IDLProxyObject> create(File file, boolean debug, File path) throws IOException {
        List<CodeDependent> cds = new ArrayList<CodeDependent>();
        return create(file, debug, path, cds, new HashSet<String>());
    }
1081923
public void generateTreeFile() throws IOException {
        Content body = getTreeHeader();
        Content headContent = getResource("doclet.Hierarchy_For_All_Packages");
        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
                HtmlStyle.title, headContent);
        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
        addPackageTreeLinks(div);
        body.addContent(div);
        HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
        divTree.addStyle(HtmlStyle.contentContainer);
        addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
        addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
        addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
        addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
        body.addContent(divTree);
        addNavLinks(false, body);
        addBottom(body);
        printHtmlDocument(null, true, body);
    }
1361595
@Override
    public ComponentBuilder addDirectory(String target) throws IOException
    {
        checkTarget(target);
        FileBuilder fb = new FileBuilder(target);
        fileBuilders.add(fb);
        return fb;
    }
774268
@Override
    public List<FileSource> createSources(String srcName) {
        final File dirOrFile = new File(srcName);

        final File[] files = dirOrFile.listFiles(FILTER);
        if (files != null) {
            final List<FileSource> sources = new ArrayList<FileSource>(files.length);
            for (File file : files) {
                sources.add(new FileSource(file));
            }
            return sources;
        } else {
            return Util.list(new FileSource(dirOrFile));
        }
    }
643614
@Override
    public ICodeBaseLocator createFilesystemCodeBaseLocator(String pathName) {
        // Attempt to canonicalize the pathname.
        // It's not fatal if we can't.
        try {
            pathName = new File(pathName).getCanonicalPath();
        } catch (IOException e) {
            // Ignore
        }

        return new FilesystemCodeBaseLocator(pathName);
    }
574644
public static void create(String zipFilename, String... filenames)
            throws IOException {

        try (FileSystem zipFileSystem = createZipFileSystem(zipFilename, true)) {
            final Path root = zipFileSystem.getPath("/");

            //iterate over the files we need to add
            for (String filename : filenames) {
                final Path src = Paths.get(filename);

                //add a file to the zip file system
                if(!Files.isDirectory(src)){
                    final Path dest = zipFileSystem.getPath(root.toString(),
                            src.toString());
                    final Path parent = dest.getParent();
                    if(Files.notExists(parent)){
                        if(logger.isDebugEnabled()) logger.debug("Creating directory %s", parent);
                        Files.createDirectories(parent);
                    }
                    Files.copy(src, dest, StandardCopyOption.REPLACE_EXISTING);
                }
                else{
                    //for directories, walk the file tree
                    Files.walkFileTree(src, new SimpleFileVisitor<Path>(){
                        @Override
                        public FileVisitResult visitFile(Path file,
                                                         BasicFileAttributes attrs) throws IOException {
                            final Path dest = zipFileSystem.getPath(root.toString(),
                                    file.toString());
                            Files.copy(file, dest, StandardCopyOption.REPLACE_EXISTING);
                            return FileVisitResult.CONTINUE;
                        }

                        @Override
                        public FileVisitResult preVisitDirectory(Path dir,
                                                                 BasicFileAttributes attrs) throws IOException {
                            final Path dirToCreate = zipFileSystem.getPath(root.toString(),
                                    dir.toString());
                            if(Files.notExists(dirToCreate)){
                                if(logger.isDebugEnabled()) logger.debug("Creating directory %s\n", dirToCreate);
                                Files.createDirectories(dirToCreate);
                            }
                            return FileVisitResult.CONTINUE;
                        }
                    });
                }
            }
        }
    }
182771
public static synchronized void createSource(Java._ClassBody clazz)
			throws IOException {
		if (baseDir == null) {
			throw new IOException("Base directory for output not set, use 'setBaseDirectory'");
		}
		String pkg = clazz.getPackage();
		if (pkg == null) {
			pkg = "";
//			throw new IOException("Class package cannot be null");
		}
		pkg = pkg.replace('.', '/');

		File path = new File(baseDir, pkg);
		path.mkdirs();
		try (PrintWriter fp = new PrintWriter(new FileWriter(new File(path, clazz.getName() + ".java")))) {
			clazz.emit(0, fp);
		}
	}
1103247
protected final SourceFolder getOrCreateSourceFolder(String name) {
		SourceFolder sourceFolder = this.sourceFolders.get(name);
		if (sourceFolder == null) {
			sourceFolder = new SourceFolder(name);
			this.sourceFolders.put(name, sourceFolder);
		}
		return sourceFolder;
	}