Class FileIOUtils

java.lang.Object
com.vaadin.flow.server.frontend.FileIOUtils

public class FileIOUtils extends Object
  • Method Details

    • writeIfChanged

      public static boolean writeIfChanged(File file, List<String> content) throws IOException
      Writes the given content into the given file unless the file already contains that content.
      Parameters:
      file - the file to write to
      content - the lines to write
      Returns:
      true if the content was written to the file, false otherwise
      Throws:
      IOException - if something went wrong
    • writeIfChanged

      public static boolean writeIfChanged(File file, String content) throws IOException
      Writes the given content into the given file unless the file already contains that content.
      Parameters:
      file - the file to write to
      content - the content to write
      Returns:
      true if the content was written to the file, false otherwise
      Throws:
      IOException - if something went wrong
    • getProjectFolderFromClasspath

      public static File getProjectFolderFromClasspath()
      Try determining the project folder from the classpath.
      Returns:
      A file referring to the project folder or null if the folder could not be determined
    • isProbablyTemporaryFile

      public static boolean isProbablyTemporaryFile(File file)
      Checks if the given file is likely a temporary file created by an editor.
      Parameters:
      file - the file to check
      Returns:
      true if the file is likely a temporary file, false otherwise