Enum FileManager

    • Method Detail

      • values

        public static FileManager[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (FileManager c : FileManager.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static FileManager valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • isValidName

        public boolean isValidName​(String name)
        Returns true if the given name is not null and contains only valid characters. This function does not check whether the file with the given name exists.
      • fetchFileContent

        public String fetchFileContent​(String name)
                                throws IOException
        Returns the content of the file with the given name.
        Parameters:
        name - the name of the file
        Throws:
        IOException
      • saveFile

        public void saveFile​(String name,
                             String base64Content)
                      throws IOException
        Save a file.
        Parameters:
        name - the name of the file to save
        base64Content - the content to write to the file, encoded with base64.
        Throws:
        IOException
      • renameFile

        public void renameFile​(String oldName,
                               String newName)
                        throws IOException
        Renames the file with the given name.
        Parameters:
        oldName - the old name of the file
        newName - the new name of the file
        Throws:
        IOException
      • copyFile

        public void copyFile​(String oldName,
                             String newName)
                      throws IOException
        Copies the file with the given name.
        Parameters:
        oldName - the old name of the file
        newName - the new name of the file
        Throws:
        IOException
      • deleteFiles

        public boolean deleteFiles​(String[] names)
        Delete the files with the given names.
        Parameters:
        names - the names of the files to delete
      • getPathForFile

        public String getPathForFile​(String name)