Class ScriptUtils


  • public class ScriptUtils
    extends Object
    A helper class for Script related stuff.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • ScriptUtils

        public ScriptUtils()
    • Method Detail

      • copy

        public static void copy​(File sourceLocation,
                                File targetLocation)
                         throws IOException
        Copies the file/directory (recursively).
        Parameters:
        sourceLocation - the source file/dir
        targetLocation - the target file/dir
        Throws:
        IOException - if copying fails
      • move

        public static void move​(File sourceLocation,
                                File targetLocation)
                         throws IOException
        Moves the file/directory (recursively).
        Parameters:
        sourceLocation - the source file/dir
        targetLocation - the target file/dir
        Throws:
        IOException - if moving fails
      • save

        public static boolean save​(File file,
                                   String content)
        Saves the content to a file.
        Parameters:
        file - the file to save to
        content - the content to save
        Returns:
        true if successfully saved
      • load

        public static String load​(File file)
        Tries to load the file and return its content.
        Parameters:
        file - the file to open
        Returns:
        the content, otherwise null