Package Torello.Java

Interface IOExceptionHandler

  • All Superinterfaces:
    java.util.function.BiConsumer<FileNode,​java.io.IOException>, java.io.Serializable

    public interface IOExceptionHandler
    extends java.util.function.BiConsumer<FileNode,​java.io.IOException>, java.io.Serializable
    IOExceptionHandler - Documentation.

    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.




    • Field Detail

      • serialVersionUID

        static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. 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
        Code:
        Exact Field Declaration Expression:
        1
        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.
        Code:
        Exact Field Declaration Expression:
        1
        2
        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,
                    java.io.IOException e)
        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,​java.io.IOException>
        Parameters:
        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.