Class FileHelper

Object
FileHelper

public class FileHelper extends Object
This class is used to get the original File object which leads to a directory, the File object is then converted to an Arraylist carrying File objects that lead to each file in the directory. This Arraylist is returned.
  • Constructor Details

    • FileHelper

      public FileHelper()
  • Method Details

    • getFileDirectory

      public ArrayList<File> getFileDirectory(String fileDir)
      Takes a folder path as a parameter and creates a File object out of it, this File object is a directory, so it is converted to an Arraylist holding File objects.
      Parameters:
      fileDir - String that contains the path to a directory of Product files.
      Returns:
      Arraylist populated with the "ShipmentFolder"s File objects.
    • getFileScanner

      public Scanner getFileScanner(File fileToRead)
      A File object is used to create a Scanner object to read from. The 'try' in this case means it will "try" to create a Scanner from the File object. and if the "try" fails, it will be "caught" and we will print our error, FileNotFoundException.
      Parameters:
      fileToRead - File object that is linked to one file that will be used as a Product.
      Returns:
      A Scanner that leads to provided file.