Class FileUtils

java.lang.Object
ch.njol.skript.util.FileUtils

public abstract class FileUtils extends Object
  • Method Details

    • getBackupSuffix

      public static String getBackupSuffix()
      Returns:
      The current date and time
    • backup

      public static File backup(File f) throws IOException
      Throws:
      IOException
    • move

      public static File move(File from, File to, boolean replace) throws IOException
      Throws:
      IOException
    • copy

      public static void copy(File from, File to) throws IOException
      Throws:
      IOException
    • renameAll

      public static Collection<File> renameAll(File directory, Converter<String,​String> renamer) throws IOException
      Parameters:
      directory -
      renamer - Renames files. Return null to leave a file as-is.
      Returns:
      A collection of all changed files (with their new names)
      Throws:
      IOException - If renaming one of the files caused an IOException. Some files might have been renamed already.
    • save

      public static void save(InputStream in, File file) throws IOException
      Saves the contents of an InputStream in a file.
      Parameters:
      in - The InputStream to read from. This stream will not be closed when this method returns.
      file - The file to save to. Will be replaced if it exists, or created if it doesn't.
      Throws:
      IOException