Java Text File Write nio write(String content, String file)

Here you can find the source of write(String content, String file)

Description

write

License

Open Source License

Declaration

public static void write(String content, String file) throws IOException 

Method Source Code

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

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

public class Main {
    public static void write(String content, String file) throws IOException {
        try (BufferedWriter writer = new BufferedWriter(
                new OutputStreamWriter(new FileOutputStream(file), Charset.defaultCharset()))) {
            writer.write(content);//from w w  w . j  a va  2  s .  c om
        }
    }
}

Related

  1. write(final Map dataBase, final File currentFile)
  2. write(final Object o, final String filename)
  3. write(final OutputStream outputStream, final String string)
  4. write(final StringBuffer data, final Writer output)
  5. write(OutputStream stream, String string)
  6. write(String location, String content)
  7. write(String msg)
  8. writeAllLines(File file, List list)
  9. writeAllText(File file, String contents)