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