Java Path File Write nio write(Path path, String string)

Here you can find the source of write(Path path, String string)

Description

write

License

Apache License

Declaration

public static void write(Path path, String string) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void write(Path path, String string) throws IOException {
        PrintWriter out = null;/*from   w  ww.j  a v  a  2 s. co m*/
        try {
            out = new PrintWriter(Files.newOutputStream(path));
            out.write(string);
        } finally {
            if (out != null) {
                out.close();
            }
        }
    }
}

Related

  1. srcImageToSavePath(String src, Path saveFolder)
  2. write(List list, String outputPath)
  3. write(Object obj, String filePath)
  4. write(Path p)
  5. write(Path p, String s)
  6. writeAudio(String source, String writePath)
  7. writeEndStringInFile(Path path, String s)
  8. writeFile(String filePath, String text)
  9. writeFile(String path, String output)