Here you can find the source of saveFiles(final List
Parameter | Description |
---|---|
contents | a parameter |
outputDirectory | a parameter |
dirName | a parameter |
fileExtension | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
private static void saveFiles(final List<String> contents, final File outputDirectory, final String outputName, final String fileExtension) throws IOException
//package com.java2s; /*/*from w w w.j a v a 2 s. c om*/ * Copyright 2012 jccastrejon * * This file is part of ExSchema. * * ExSchema is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * ExSchema is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with ExSchema. If not, see <http://www.gnu.org/licenses/>. */ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.List; public class Main { /** * Save file contents in an output directory. * * @param contents * @param outputDirectory * @param dirName * @param fileExtension * @throws IOException */ private static void saveFiles(final List<String> contents, final File outputDirectory, final String outputName, final String fileExtension) throws IOException { int index; File directory; File rooScriptFile; FileWriter fileWriter; // Save scripts in a new folder directory = new File(outputDirectory, outputName); directory.mkdir(); index = 0; for (String content : contents) { index = index + 1; rooScriptFile = new File(directory, "schema" + index + "." + fileExtension); fileWriter = new FileWriter(rooScriptFile, false); fileWriter.write(content); fileWriter.close(); } } }