Java Path File Write nio writeToFile(String s, Path file)

Here you can find the source of writeToFile(String s, Path file)

Description

write To File

License

Open Source License

Declaration

public static void writeToFile(String s, Path file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void writeToFile(String s, Path file) throws IOException {
        BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8);
        writer.append(s);//from  w w  w . j a va2  s .  co  m
        writer.close();
    }
}

Related

  1. writeToFile(double[] testSample, Path classificationTestFile)
  2. writeToFile(final Path file, final String text)
  3. writeToFile(Path file, boolean isAppendingToFile, List lines)
  4. writeToFile(Path path, String string)
  5. writeToFile(String log, Path path)
  6. writeUntouchedImage(Path sourceFile, Path destFile)