Java Text File Write nio writeStringToFile(File file, String content, String value)

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

Description

write String To File

License

Open Source License

Declaration

public static void writeStringToFile(File file, String content, String value) throws IOException 

Method Source Code


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

import java.io.*;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.Collections;

public class Main {
    public static void writeStringToFile(File file, String content, String value) throws IOException {
        Files.write(file.toPath(), Collections.singletonList(new String(content.getBytes(value), value)),
                Charset.forName(value), StandardOpenOption.CREATE);
    }/*  w w  w . j a v a 2 s . c  om*/
}

Related

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