1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | package Torello.Java; import java.util.function.BiConsumer; import java.io.IOException; /** * A functional-interface, used in case of <CODE>IOException</CODE>, to be used alongside the * <CODE>'GREP'</CODE> Tool. * * <EMBED CLASS='external-html' DATA-FILE-ID=IO_EX_HANDLER> */ public interface IOExceptionHandler extends BiConsumer<FileNode, IOException>, java.io.Serializable { /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDFI> */ public static final long serialVersionUID = 1; /** * <EMBED CLASS='external-html' DATA-FILE-ID=FUNC_INTER_METH> * * @param fn This may be any FileNode * * @param e This exception is passed indicating that an {@code IOException} occurred when * attempting to search or {@code 'GREP'} through this file. The programmer may do or perform * any type of exception handling needed. */ public void accept(FileNode fn, IOException e); /** * Unless a more advanced behavior is expected, this {@code IOException} handler should suffice * for most of the routines in the {@code GREP} and the {@code FileNode} classes. It simply * prints the standard {@code IOException} stack trace to the standard {@code System out}. */ public static IOExceptionHandler SIMPLE = (FileNode fn, IOException e) -> { System.out.println("File: " + fn.toString() + "\tFAILED TO LOAD\n" + e.toString()); }; } |