BowlerKernel
FileUtil.java
Go to the documentation of this file.
1 
31 package eu.mihosoft.vrl.v3d;
32 
33 import java.io.BufferedWriter;
34 import java.io.IOException;
35 import java.nio.charset.Charset;
36 import java.nio.file.Files;
37 import java.nio.file.Path;
38 import java.nio.file.StandardOpenOption;
39 
40 // TODO: Auto-generated Javadoc
46 public class FileUtil {
47 
51  private FileUtil() {
52  throw new AssertionError("Don't instantiate me", null);
53  }
54 
63  public static void write(Path p, String s) throws IOException {
64  try (BufferedWriter writer = Files.newBufferedWriter(p, Charset.forName("UTF-8"),
65  StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
66  writer.write(s, 0, s.length());
67  }
68  }
69 
78  public static String read(Path p) throws IOException {
79  return new String(Files.readAllBytes(p), Charset.forName("UTF-8"));
80  }
81 }
static String read(Path p)
Definition: FileUtil.java:78
static void write(Path p, String s)
Definition: FileUtil.java:63