public static void writeTextFile(final File file, final String text) throws IOException {
    Preconditions.checkNotNull(file, "Error: file argument can not be null");
    Preconditions.checkNotNull(text, "Error: text argument can not be null");
    final BufferedWriter writer = new BufferedWriter(new FileWriter(file));
    try {
      writer.write(text);
    } finally {
      writer.close();
    }
  }
Write text to file.

@param file The {@link File file} to write to.
@param text The {@link String text} which to write.
@throws IOException if the text could not be written to the file.
java/zylib/src/main/java/com/google/security/zynamics/zylib/io/FileUtils.java