001package Torello.Java;
002
003import java.util.function.BiConsumer;
004import java.io.IOException;
005
006/**
007 * A functional-interface, used in case of <CODE>IOException</CODE>, to be used alongside the
008 * <CODE>'GREP'</CODE> Tool.
009 * 
010 * <BR /><BR /><EMBED CLASS="external-html" DATA-FILE-ID="IOEH">
011 */
012public interface IOExceptionHandler extends BiConsumer<FileNode, IOException>, java.io.Serializable
013{
014    /** <EMBED CLASS="external-html" DATA-FILE-ID="SVUIDFI">  */
015    public static final long serialVersionUID = 1;
016
017    /**
018     * <B><SPAN STYLE="color: red;">FUNCTIONAL-INTERFACE BOOLEAN METHOD:</SPAN></B> This is the
019     * method that fulfils this {@code functional-interface 'test'} method.
020     *
021     * @param fn This may be any FileNode
022     *
023     * @param e This exception is passed indicating that an {@code IOException} occurred when
024     * attempting to search or {@code 'GREP'} through this file.  The programmer may do or perform
025     * any type of exception handling needed. 
026     */
027    public void accept(FileNode fn, IOException e);
028
029    /**
030     * Unless a more advanced behavior is expected, this {@code IOException} handler should suffice
031     * for most of the routines in the {@code GREP} and the {@code FileNode} classes.  It simply
032     * prints the standard {@code IOException} stack trace to the standard {@code System out}.
033     */
034    public static IOExceptionHandler SIMPLE = (FileNode fn, IOException e) ->
035    { System.out.println("File: " + fn.toString() + "\tFAILED TO LOAD\n" + e.toString()); };
036}