* 리팩터링
This commit is contained in:
@@ -28,7 +28,8 @@ public class ExcelRowReader implements ItemReader<Row> {
|
|||||||
Workbook workbook = WorkbookFactory.create(fileInputStream);
|
Workbook workbook = WorkbookFactory.create(fileInputStream);
|
||||||
Sheet sheet = workbook.getSheetAt(0);
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
this.rowCursor = sheet.iterator();
|
this.rowCursor = sheet.iterator();
|
||||||
// Skip header row if necessary
|
|
||||||
|
|
||||||
if (rowCursor.hasNext()) {
|
if (rowCursor.hasNext()) {
|
||||||
rowCursor.next();
|
rowCursor.next();
|
||||||
}
|
}
|
||||||
@@ -36,10 +37,11 @@ public class ExcelRowReader implements ItemReader<Row> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Row read() {
|
public Row read() {
|
||||||
|
|
||||||
if (rowCursor != null && rowCursor.hasNext()) {
|
if (rowCursor != null && rowCursor.hasNext()) {
|
||||||
return rowCursor.next();
|
return rowCursor.next();
|
||||||
} else {
|
} else {
|
||||||
return null; // No more rows to read
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user