001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014package org.gbif.utils.file; 015 016/** 017 * Interface that extends the ClosableIterator providing a means to check if there is an error, log what it is, store 018 * the actual Exception, and skip over it to continue reading. 019 * 020 * @param <T> the type of elements returned by the iterator 021 */ 022public interface ClosableReportingIterator<T> extends ClosableIterator<T> { 023 024 /** 025 * Return true if an error was encountered while iterating over row. 026 */ 027 boolean hasRowError(); 028 029 /** 030 * Return an informative message about the error encountered while iterating over row. 031 * Different from the Exception's message, used to store the row number, row string, etc. 032 */ 033 String getErrorMessage(); 034 035 /** 036 * Return the Exception encountered while iterating over row. 037 */ 038 Exception getException(); 039}