Class ListLoader

All Implemented Interfaces:
ILoader

public class ListLoader extends AbstractStartupInfoLoader
Implements an EASy loader which obtains the start sequence from a text file.
Author:
Holger Eichelberger
  • Field Details

  • Constructor Details

    • ListLoader

      public ListLoader() throws IOException
      Creates a list loader that reads the startup sequence from the current class loader, i.e., from EASY_STARTUP_FILE_NAME.
      Throws:
      IOException - in case of loading the startup sequence fails
    • ListLoader

      public ListLoader(ClassLoader loader) throws IOException
      Creates a list loader that reads the startup sequence from the given class loader, i.e., from EASY_STARTUP_FILE_NAME.
      Parameters:
      loader - the class loader to load from
      Throws:
      IOException - in case of loading the startup sequence fails
    • ListLoader

      public ListLoader(File listFile) throws IOException
      Creates a list loader that reads the startup sequence from the given file.
      Parameters:
      listFile - the file to consider (may be null for reading information from the defailt classloader resource)
      Throws:
      IOException - in case of loading the startup sequence fails
    • ListLoader

      public ListLoader(File listFile, ClassLoader loader) throws IOException
      Creates a list loader that reads the startup sequence from the given file.
      Parameters:
      listFile - the file to consider (may be null for reading information from loader)
      loader - the class loader to load from
      Throws:
      IOException - in case of loading the startup sequence fails
    • ListLoader

      public ListLoader(InputStream is) throws IOException
      Creates a list loader that reads the startup sequence from an input stream. is will be closed by this constructor.
      Parameters:
      is - the input stream containing the startup sequence
      Throws:
      IOException - in case of loading the startup sequence fails
    • ListLoader

      public ListLoader(Reader reader) throws IOException
      Creates a list loader that reads the startup sequence from a reader. reader will be closed by this constructor.
      Parameters:
      reader - the reader providing access to the startup sequence
      Throws:
      IOException - in case of loading the startup sequence fails
  • Method Details

    • load

      private static List<StartupInfo> load(InputStream is) throws IOException
      Loads the startup sequence from an input stream. is will not be closed by this method.
      Parameters:
      is - the input stream containing the startup sequence
      Returns:
      the loaded startup information
      Throws:
      IOException - in case of loading the startup sequence fails
    • getStream

      private static InputStream getStream(File listFile, ClassLoader loader) throws IOException
      Returns the underlying input stream.
      Parameters:
      listFile - the file to consider (may be null for reading information from loader)
      loader - the class loader to load from
      Returns:
      the input stream
      Throws:
      IOException - in case of loading the startup sequence fails
    • load

      private static List<StartupInfo> load(Reader reader) throws IOException
      Loads the startup sequence from a reader. reader will be closed by this method.
      Parameters:
      reader - the reader providing access to the startup sequence
      Returns:
      the loaded startup information
      Throws:
      IOException - in case of loading the startup sequence fails
    • processLine

      private static void processLine(String line, List<StartupInfo> startupSequence)
      Processes a single line from the startup sequence file.
      Parameters:
      line - the line to be processed
      startupSequence - the startup sequence to be modified as a side effect