Here you can find the source of writeToFile(String outputFile, String contents)
public static void writeToFile(String outputFile, String contents)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void writeToFile(String outputFile, String contents) { writeToFile(Paths.get(outputFile), contents); }/*from w w w . j a v a 2s. c om*/ public static void writeToFile(Path path, String contents) { try { Files.write(path, contents.getBytes()); } catch (IOException e) { throw new UnsupportedOperationException("Failed to write to file '" + path + "'", e); } } }