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
A functional-interface, used in case ofIOException
, 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.
Hi-Lited Source-Code:- View Here: Torello/Java/IOExceptionHandler.java
- Open New Browser-Tab: Torello/Java/IOExceptionHandler.java
-
-
Field Summary
Serializable ID Modifier and Type Field static long
serialVersionUID
Standard Handler Instance Modifier and Type Field static IOExceptionHandler
SIMPLE
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
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:
public static final long serialVersionUID = 1;
-
SIMPLE
static final IOExceptionHandler SIMPLE
Unless a more advanced behavior is expected, thisIOException
handler should suffice for most of the routines in theGREP
and theFileNode
classes. It simply prints the standardIOException
stack trace to the standardSystem out
.- Code:
- 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, java.io.IOException e)
FUNCTIONAL-INTERFACE BOOLEAN METHOD: This is the method that fulfils thisfunctional-interface 'test'
method.- Specified by:
accept
in interfacejava.util.function.BiConsumer<FileNode,java.io.IOException>
- Parameters:
fn
- This may be any FileNodee
- This exception is passed indicating that anIOException
occurred when attempting to search or'GREP'
through this file. The programmer may do or perform any type of exception handling needed.
-
-