Here you can find the source of saveHeaders(Path path, ArrayList
synchronized public static void saveHeaders(Path path, ArrayList<String> headers)
//package com.java2s; // Use of this software is governed by the GPLv3 license import java.io.BufferedWriter; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; public class Main { synchronized public static void saveHeaders(Path path, ArrayList<String> headers) { try (BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) { for (String line : headers) { writer.write(line);// w w w. j a v a 2s. c o m writer.newLine(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }