org.jxls.reader.XLSRowCursorImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jxls-reader Show documentation
Show all versions of jxls-reader Show documentation
Jxls Reader module to read Excel files
package org.jxls.reader;
import java.util.NoSuchElementException;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
/**
* @author Leonid Vysochyn
*/
public class XLSRowCursorImpl implements XLSRowCursor {
int currentRowNum;
Sheet sheet;
String sheetName;
public XLSRowCursorImpl(Sheet sheet) {
this.sheet = sheet;
}
public XLSRowCursorImpl(String sheetName, Sheet sheet) {
this.sheetName = sheetName;
this.sheet = sheet;
}
public int getCurrentRowNum() {
return currentRowNum;
}
public Row getCurrentRow() {
return sheet.getRow( currentRowNum );
}
public Sheet getSheet() {
return sheet;
}
public void setSheet(Sheet sheet) {
this.sheet = sheet;
}
public String getSheetName() {
return sheetName;
}
public void setSheetName(String sheetName) {
this.sheetName = sheetName;
}
public Row next() {
if( hasNext() ){
return sheet.getRow( currentRowNum++ );
}
throw new NoSuchElementException();
}
public boolean hasNext() {
return (currentRowNum <= sheet.getLastRowNum());
}
public void reset() {
currentRowNum = 0;
}
public void setCurrentRowNum(int rowNum) {
currentRowNum = rowNum;
}
public void moveForward() {
currentRowNum++;
}
public void moveBackward() {
currentRowNum--;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy