Class WriteStringToFile

Object
WriteStringToFile

public class WriteStringToFile extends Object
Writes a string to a text file.
  • Method Details

    • writeTextFile

      public static void writeTextFile(String contents, Path filePath) throws IOException
      Creates a new text-file at filePath whose contents are contents.
      Parameters:
      contents - successive characters that will be written to the text-file.
      filePath - the path of the text-file, which will be overwritten if it already exists.
      Throws:
      IOException - if the file already exists and is a directory, or if it cannot be created.