Java Text File Write nio writeToTextFile(String fileName, String content)

Here you can find the source of writeToTextFile(String fileName, String content)

Description

write To Text File

License

Open Source License

Declaration

public static void writeToTextFile(String fileName, String content) throws IOException 

Method Source Code


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

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

public class Main {
    public static void writeToTextFile(String fileName, String content) throws IOException {
        Files.write(Paths.get(fileName), content.getBytes(), StandardOpenOption.CREATE);
    }/*  w w  w.  j  a  v  a 2 s  . c  o m*/
}

Related

  1. writeToFile(String content, String fileName)
  2. writeToFile(String content, String fileName, boolean createFile)
  3. writeToFile(String filename, String fileContents)
  4. writeToFile(String filename, String... lines)
  5. writeTokenText(OutputStream theOs, String theStr)