Java Path File Write nio writeString(String path, String data)

Here you can find the source of writeString(String path, String data)

Description

write String

License

Apache License

Declaration

public static void writeString(String path, String data) throws IOException 

Method Source Code

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

import java.io.BufferedWriter;

import java.io.FileOutputStream;
import java.io.IOException;

import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void writeString(String path, String data) throws IOException {
        try (BufferedWriter writer = new BufferedWriter(
                new OutputStreamWriter(new FileOutputStream(path), StandardCharsets.UTF_8))) {
            writer.write(data);//from   w w w  .j  a va  2  s.c o  m
        }
    }
}

Related

  1. writeLines(Path path, T... a)
  2. writeLineS(String filePath, String msg, int line)
  3. writeOrAppendLinesToFile(boolean append, Path filePath, String... lines)
  4. writeOutputToFile(Path path)
  5. writeString(Path path, String str)
  6. writeStringAndNewLineToBufferedWriter(String line, BufferedWriter writer, Path path)
  7. writeStringToFile(Path path, String data)
  8. writeTagset(Path outPath, Set tagset)
  9. writeTestData(final String testdata, final Path tempfile)