Java Path File Write nio writeFile(String path, String output)

Here you can find the source of writeFile(String path, String output)

Description

write File

License

Apache License

Declaration

public static void writeFile(String path, String output) throws IOException 

Method Source Code


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

import java.io.*;
import java.nio.charset.Charset;

public class Main {
    final static Charset UTF8 = Charset.forName("UTF-8");

    public static void writeFile(String path, String output) throws IOException {
        Writer writer = new OutputStreamWriter(new FileOutputStream(path), UTF8);
        try {//from  w  ww. ja va  2  s. co  m
            writer.write(output);
        } finally {
            writer.close();
        }
    }
}

Related

  1. write(Path p, String s)
  2. write(Path path, String string)
  3. writeAudio(String source, String writePath)
  4. writeEndStringInFile(Path path, String s)
  5. writeFile(String filePath, String text)
  6. writeFile(String payload, Path balOutPath)
  7. writeFileToArchive(final ZipOutputStream zos, final Path baseSrcPath, final Path filePath)
  8. writeFully(Path filePath, byte[] bytes)
  9. writeJaasConfig(File krbDir, String princ, String keytabPath)