生成指定的文件

@throws IOException
346457
static public void generateFiles(Collection<String> paths, String fileName,
			InputStream is) throws IOException {
		Vector<FileOutputStream> vecFiles = new Vector<FileOutputStream>();
		byte[] ba = new byte[102400];
		int len;

		for (String path : paths)
			vecFiles.add(new FileOutputStream(path + fileName));

		len = is.read(ba);
		while (len > 0) {
			for (FileOutputStream os : vecFiles)
				os.write(ba, 0, len);
			len = is.read(ba);
		}

		for (FileOutputStream os : vecFiles)
			os.close();
	}
504970
private String generateFilename() {
        String counter = "";
        if (capabilities.getInstance() > 0) {
            counter = "_" + capabilities.getInstance();
        }
        return test + counter;
    }
217647
def _generate(self):
        

        needs_close = False

        if sys.hexversion >= 0x03000000:
            if self._opts.output == '-':
                from io import TextIOWrapper

                pyfile = TextIOWrapper(sys.stdout.buffer, encoding='utf8')
            else:
                pyfile = open(self._opts.output, 'wt', encoding='utf8')
                needs_close = True
        else:
            if self._opts.output == '-':
                pyfile = sys.stdout
            else:
                pyfile = open(self._opts.output, 'wt')
                needs_close = True

        import_from = self._opts.import_from

        if import_from:
            from_imports = True
        elif self._opts.from_imports:
            from_imports = True
            import_from = '.'
        else:
            from_imports = False

        compileUi(self._ui_file, pyfile, self._opts.execute, self._opts.indent,
                from_imports, self._opts.resource_suffix, import_from)

        if needs_close:
            pyfile.close()
1073757
public static synchronized File createSwapFile() throws IOException {
		File swapFile = createSwapFile(SWAP_FILE_PREFIX, SWAP_FILE_SUFFIX);
		// works reliably only on Unix platforms!
		swapFile.deleteOnExit();
		return swapFile;
	}
1264039
public File createFileSync(String prefix, String suffix) throws IOException {
		File tmp;
		if (tempDir == null)
			tmp = File.createTempFile(this.prefix + prefix, suffix);
		else
			tmp = File.createTempFile(this.prefix + prefix, suffix, tempDir);
		tmp.deleteOnExit();
		return tmp;
	}
159977
protected void generateHelpFile() throws IOException {
        String title = configuration.getText("doclet.Window_Help_title");
        Content body = getBody(true, getWindowTitle(title));
        addTop(body);
        addNavLinks(true, body);
        addHelpFileContents(body);
        addNavLinks(false, body);
        addBottom(body);
        printHtmlDocument(null, true, body);
    }
351365
public File write(File file) throws IOException {
        try (FileOutputStream fos = new FileOutputStream(file)) {
            write(fos);
            return file;
        }
    }
96246
public static void generateSource(Reader reader, File sourceOutputPath) throws IOException {
        ProtoFile protoFile = ProtoSchemaParser.parse(DEFAULT_FILE_NAME, reader);
        List<CodeDependent> cds = new ArrayList<CodeDependent>();
        doCreate(protoFile, true, false, null, true, sourceOutputPath, cds, new HashMap<String, String>(), false);
    }
1351991
public OutputStream write() throws IOException {
        if(gz.exists())
            gz.delete();
        try {
            return Files.newOutputStream(file.toPath());
        } catch (InvalidPathException e) {
            throw new IOException(e);
        }
    }
930700
def GenerateFile(self, input_filename=None, output_filename=None):
    """"""
    if input_filename is None:
      input_filename = output_filename + ".in"
    if output_filename[-3:] == ".in":
      output_filename = output_filename[:-3]
    logging.debug("Generating file %s from %s", output_filename, input_filename)

    with io.open(input_filename, "r") as fd:
      data = fd.read()

    with io.open(output_filename, "w") as fd:
      fd.write(config.CONFIG.InterpolateValue(data, context=self.context))
732343
private void createTempFile() throws IOException {
        _tempfilef = File.createTempFile("org.browsermob.proxy.jetty.util.TempByteHolder-",".tmp",_temp_directory).getCanonicalFile();
        _tempfilef.deleteOnExit();
        _tempfile = new RandomAccessFile(_tempfilef,"rw");
    }
108744
@Override
  public void create()
    throws IOException
  {
    Files.createDirectories(_path.getParent());

    if (Files.exists(_path)) {
      throw new IOException(L.l("CREATE for path '{0}' failed, because the file already exists.  CREATE can not override an existing table.",
                                _path));
    }
    
    init();
    /*
    _channel = _path.openFileChannel(StandardOpenOption.CREATE, 
                                     StandardOpenOption.WRITE,
                                     StandardOpenOption.READ);
    
    setFileSize(_path.length());
    
    initImpl();
    */
  }
1329570
public static void createFile(File file) throws Exception {
    File dir = new File(file.getAbsolutePath().replace(File.separator + file.getName(), ""));
    if(!dir.exists()) {
      if(!dir.mkdirs()) {
        throw new Exception("Can't create dirs "+dir);
      }
    }
    file.createNewFile();
  }
97843
public static void generate(Path outputDir) throws IOException {
    DataReader reader = DataReader.get();
    CalendarCodeGenerator datetimeGenerator = new CalendarCodeGenerator();
    Map<LocaleID, ClassName> dateClasses = datetimeGenerator.generate(outputDir, reader);

    PluralCodeGenerator pluralGenerator = new PluralCodeGenerator();
    pluralGenerator.generate(outputDir, reader);

    NumberCodeGenerator numberGenerator = new NumberCodeGenerator();
    Map<LocaleID, ClassName> numberClasses = numberGenerator.generate(outputDir, reader);
    
    LanguageCodeGenerator languageGenerator = new LanguageCodeGenerator();
    languageGenerator.generate(outputDir, reader);
    
    MethodSpec registerCalendars = indexFormatters("registerCalendars", "registerCalendarFormatter", dateClasses);
    MethodSpec registerNumbers = indexFormatters("registerNumbers", "registerNumberFormatter", numberClasses);
    
    MethodSpec constructor = MethodSpec.constructorBuilder()
        .addModifiers(PRIVATE)
        .build();

    FieldSpec instance = FieldSpec.builder(CLDR, "instance", PRIVATE, STATIC, FINAL)
        .build();

    MethodSpec getter = MethodSpec.methodBuilder("get")
        .addModifiers(PUBLIC, STATIC)
        .returns(CLDR)
        .addStatement("return instance")
        .build();

    TypeSpec.Builder type = TypeSpec.classBuilder("CLDR")
        .addModifiers(PUBLIC)
        .superclass(CLDR_BASE)
        .addMethod(constructor)
        .addMethod(getter)
        .addMethod(registerCalendars)
        .addMethod(registerNumbers);

    Set<LocaleID> availableLocales = reader.availableLocales()
        .stream()
        .map(s -> LocaleID.parse(s))
        .collect(Collectors.toSet());
    
    createLocales(type, reader.defaultContent(), availableLocales);
    createLanguageAliases(type, reader.languageAliases());
    createTerritoryAliases(type, reader.territoryAliases());
    createLikelySubtags(type, reader.likelySubtags());
    createCurrencies(type, numberGenerator.getCurrencies(reader));
    
    addPluralRules(type);

    // Initialize all static maps.
    type.addStaticBlock(CodeBlock.builder()
      .addStatement("registerCalendars()")
      .addStatement("registerNumbers()")
      .addStatement("registerDefaultContent()")
      .addStatement("registerLanguageAliases()")
      .addStatement("registerTerritoryAliases()")
      .addStatement("registerLikelySubtags()")
      .addStatement("instance = new CLDR()").build());
    
    type.addField(instance);

    saveClass(outputDir, PACKAGE_CLDR, "CLDR", type.build());
  }
576809
protected void generateFrameFile() throws IOException {
        Content frame = getFrameDetails();
        HtmlTree body = new HtmlTree(HtmlTag.BODY);
        body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
        if (configuration.allowTag(HtmlTag.MAIN)) {
            HtmlTree main = HtmlTree.MAIN(frame);
            body.addContent(main);
        } else {
            body.addContent(frame);
        }
        if (configuration.windowtitle.length() > 0) {
            printFramesDocument(configuration.windowtitle, configuration,
                    body);
        } else {
            printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
                    configuration, body);
        }
    }
1344893
public URI generateShimJarFile() {

    try {
      Set<FileResource> globalFiles = new HashSet<>();

      final File globalFolder = new File(this.reefFileNames.getGlobalFolderPath());
      final File[] filesInGlobalFolder = globalFolder.listFiles();

      for (final File fileEntry : filesInGlobalFolder != null ? filesInGlobalFolder : new File[]{}) {
        globalFiles.add(getFileResourceFromFile(fileEntry, FileType.LIB));
      }

      File jarFile = this.jobJarMaker.newBuilder()
          .addGlobalFileSet(globalFiles)
          .build();

      return uploadFile(jarFile);
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, "Failed to build JAR file", ex);
      throw new RuntimeException(ex);
    }
  }
912269
public void write() throws IOException {
		{
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + postfix;
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeGen(fileObject, jsonModel);
		}
		if (jsonModel.isBuilder()) {
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + "JsonMeta";
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeJsonMeta(fileObject, jsonModel);
		}
	}