Here you can find the source of appendLinesToFile(Iterable
Parameter | Description |
---|---|
lines | a parameter |
outFile | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void appendLinesToFile(Iterable<String> lines, File outFile) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**/*from w ww . jav a2 s . co m*/ * Append a bunch of String to a new File, line by line. If necessary, the file is created. * * @param lines * @param outFile * @throws IOException */ public static void appendLinesToFile(Iterable<String> lines, File outFile) throws IOException { if (outFile == null || lines == null) throw new IOException("Got null args"); outFile.createNewFile(); PrintWriter pw = new PrintWriter(new FileOutputStream(outFile, true)); try { for (String line : lines) pw.println(line); } finally { pw.close(); } } }