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 * <EMBED CLASS='external-html' DATA-FILE-ID=IO_EX_HANDLER>
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     * <EMBED CLASS='external-html' DATA-FILE-ID=FUNC_INTER_METH>
019     *
020     * @param fn This may be any FileNode
021     *
022     * @param e This exception is passed indicating that an {@code IOException} occurred when
023     * attempting to search or {@code 'GREP'} through this file.  The programmer may do or perform
024     * any type of exception handling needed. 
025     */
026    public void accept(FileNode fn, IOException e);
027
028    /**
029     * Unless a more advanced behavior is expected, this {@code IOException} handler should suffice
030     * for most of the routines in the {@code GREP} and the {@code FileNode} classes.  It simply
031     * prints the standard {@code IOException} stack trace to the standard {@code System out}.
032     */
033    public static IOExceptionHandler SIMPLE = (FileNode fn, IOException e) ->
034    { System.out.println("File: " + fn.toString() + "\tFAILED TO LOAD\n" + e.toString()); };
035}