question: public static void executeStrategyOnExcelSheet ( InputStream is , RowStrategy rowStrategy , ExcelUtilStatus status ) throws IOException { BufferedInputStream bis = new BufferedInputStream ( is ) ; bis . mark ( 32 ) ; Map < String , Integer > headerMapping = new HashMap < String , Integer > ( ) ; try { Workbook workbook = WorkbookFactory . create ( bis ) ; Sheet sheet = workbook . getSheetAt ( 0 ) ; status . setTotalNumberOfRows ( sheet . getLastRowNum ( ) ) ; Iterator < Row > rowIterator = sheet . rowIterator ( ) ; while ( rowIterator . hasNext ( ) ) { status . newRow ( ) ; Row row = rowIterator . next ( ) ; if ( status . getCurrentRowNumber ( ) == 1 ) { headerMapping = readHeaderMapping ( row ) ; } else { try { Map < String , Object > content = getRowAsMap ( row , headerMapping ) ; rowStrategy . executeRow ( content ) ; status . addSuccesfulRow ( ) ; } catch ( Exception e ) { status . addFailedRowWithException ( e ) ; } } } } catch ( Exception e ) { Logger . warn ( ExcelUtil . class , "Can't read Excel file, trying csv format: " + e . getMessage ( ) ) ; bis . reset ( ) ; ICsvMapReader inFile = new CsvMapReader ( new InputStreamReader ( bis ) , CsvPreference . EXCEL_PREFERENCE ) ; try { final String [ ] header = inFile . getHeader ( true ) ; Map < String , String > stringMap ; while ( ( stringMap = inFile . read ( header ) ) != null ) { Map < String , Object > row = getStringMapAsMap ( stringMap ) ; try { rowStrategy . executeRow ( row ) ; status . addSuccesfulRow ( ) ; } catch ( Exception e2 ) { status . addFailedRowWithException ( e2 ) ; } } } catch ( IOException ioe ) { Logger . error ( ExcelUtil . class , "Can't read excel file as CSV" , ioe ) ; Logger . error ( ExcelUtil . class , "Original WorkbookFactory excel reader error:" , e ) ; } } status . setFinished ( ) ; }
target:  Parses an excel sheet (in the FileInputStream). The first row is read and stored in a Map, all the other rows are parsed using the given RowStrategy. All thrown exceptions in the row are stored in the returned ExcelUtilStatus and returned after executing the stategy.