Java Text File Write nio writeStringToFile(File file, String string)

Here you can find the source of writeStringToFile(File file, String string)

Description

write String To File

License

Apache License

Declaration

public static void writeStringToFile(File file, String string) throws Exception 

Method Source Code


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

import java.io.File;

import java.nio.file.Files;

public class Main {
    private static final String TEXT_CHARSET = "UTF-8";

    public static void writeStringToFile(File file, String string) throws Exception {
        Files.write(file.toPath(), string.getBytes(TEXT_CHARSET));
    }// www .  j  a v a2s  . c  o m
}

Related

  1. writeString(DataOutput dOut, String value)
  2. writeString(File file, String content)
  3. writeString(final File file, final String str)
  4. writeString(OutputStream buffer, String s)
  5. writeStringToFile(File file, String content, String value)
  6. writeStringToFile(File file, String text)
  7. writeStringToFile(final File file, final String content)
  8. writeStringToFile(String s, File f)
  9. writeTextFile(final File file, final String text)