Class FileManagement


  • public class FileManagement
    extends java.lang.Object
    This class handles session-based file management for the robot. Every time the RoboRIO boots, a new "session" folder is created with the current timestamp. All logs and files generated by software are stored here automatically. This adds a bit of abstraction, where robot software doesn't have to worry about filepaths and timestamps, and will be automatically given a work directory on boot.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileManagement()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.FileReader createFileReader​(java.lang.String filename)
      Create a FileReader for a file inside the current session
      static java.io.FileWriter createFileWriter​(java.lang.String filename)
      Create a FileWriter for a file inside the current session
      static java.io.File getSessionDirectory()
      Get a file object for the session directory
      static java.lang.String getSessionDirectoryPath()
      Get the filepath to the session directory
      static java.lang.String getUSBStickBasePath()
      Get the base path to the attached USB stick
      static boolean isUSBAttached()
      Get if the USB stick is plugged in
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileManagement

        public FileManagement()
    • Method Detail

      • getSessionDirectoryPath

        public static java.lang.String getSessionDirectoryPath()
        Get the filepath to the session directory
        Returns:
        Session directory filepath
      • getSessionDirectory

        public static java.io.File getSessionDirectory()
        Get a file object for the session directory
        Returns:
        Session directory File object
      • createFileWriter

        public static java.io.FileWriter createFileWriter​(java.lang.String filename)
                                                   throws java.io.IOException
        Create a FileWriter for a file inside the current session
        Parameters:
        filename - File name
        Returns:
        Session FileWriter
        Throws:
        java.io.IOException - Thrown when the specified file cannot be opened
      • createFileReader

        public static java.io.FileReader createFileReader​(java.lang.String filename)
                                                   throws java.io.FileNotFoundException
        Create a FileReader for a file inside the current session
        Parameters:
        filename - File name
        Returns:
        Session FileReader
        Throws:
        java.io.FileNotFoundException - Thrown if the file does not exist
      • getUSBStickBasePath

        public static java.lang.String getUSBStickBasePath()
        Get the base path to the attached USB stick
        Returns:
        USB base path
      • isUSBAttached

        public static boolean isUSBAttached()
        Get if the USB stick is plugged in
        Returns:
        Is USB stick plugged in?