Java Text File Write nio write(String msg)

Here you can find the source of write(String msg)

Description

write

License

Open Source License

Declaration

public static void write(String msg) 

Method Source Code


//package com.java2s;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

public class Main {
    public static void write(String msg) {

        Path path = Paths.get("D:\\Program Files\\apache-activemq-5.10.0\\data\\test.txt");

        try {//  w  w w . ja  v  a  2s .c o  m
            Files.write(path, msg.getBytes(), StandardOpenOption.APPEND);
        } catch (IOException e) {
            throw new RuntimeException(msg, e);
        }
    }
}

Related

  1. write(final OutputStream outputStream, final String string)
  2. write(final StringBuffer data, final Writer output)
  3. write(OutputStream stream, String string)
  4. write(String content, String file)
  5. write(String location, String content)
  6. writeAllLines(File file, List list)
  7. writeAllText(File file, String contents)
  8. writeArray2File(File file, Object[] objects, String code)
  9. writeAscii(CharSequence ascii, OutputStream os)