Package Torello.Java

Interface IOExceptionHandler

  • All Superinterfaces:

    public interface IOExceptionHandler
    extends java.util.function.BiConsumer<FileNode,​>,
    A functional-interface, used in case of IOException, to be used alongside the 'GREP' Tool.

    This class is just intended to handle IOExceptions, and perform user-defined actions when a GREP fails for a particular file. The primary value of this interface is that users can handle exceptions without halting the entire grep-process of other files merely due to the failure to load one file.

    • Method Summary

      @FunctionalInterface (Lambda) Method
      Modifier and Type Method
      void accept​(FileNode fn, IOException e)
      • Methods inherited from interface java.util.function.BiConsumer

    • Field Detail

      • serialVersionUID

        static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Functional Interfaces are usually not thought of as Data Objects that need to be saved, stored and retrieved; however, having the ability to store intermediate results along with the lambda-functions that helped get those results can make debugging easier.
        See Also:
        Constant Field Values
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
      • SIMPLE

        🡅  🡇    
        static final IOExceptionHandler SIMPLE
        Unless a more advanced behavior is expected, this IOException handler should suffice for most of the routines in the GREP and the FileNode classes. It simply prints the standard IOException stack trace to the standard System out.
        Exact Field Declaration Expression:
         public static IOExceptionHandler SIMPLE = (FileNode fn, IOException e) ->
             { System.out.println("File: " + fn.toString() + "\tFAILED TO LOAD\n" + e.toString()); };
    • Method Detail

      • accept

        void accept​(FileNode fn,
        FUNCTIONAL-INTERFACE BOOLEAN METHOD: This is the method that fulfils this functional-interface 'test' method.
        Specified by:
        accept in interface java.util.function.BiConsumer<FileNode,​>
        fn - This may be any FileNode
        e - This exception is passed indicating that an IOException occurred when attempting to search or 'GREP' through this file. The programmer may do or perform any type of exception handling needed.