Package overit.geocall.util
Class XlsxBufferedReader
java.lang.Object
overit.geocall.util.XlsxBufferedReader
This class is an utility implementation that must be used if you want to read
the contents of a XLSX from an InputStream
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intprotected org.apache.poi.xssf.usermodel.XSSFSheetprotected org.apache.poi.xssf.usermodel.XSSFWorkbookstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeSheet(String sheetName) Changes the sheetvoidclose()Closes theXSSFWorkbookstatic final voidReads the CVS lineReads the CVS linetoDBView(int[] types, String[] formats, int headers, PrintStream ps) Returns the DBView representation of the Xlsx
-
Field Details
-
_workbook
protected org.apache.poi.xssf.usermodel.XSSFWorkbook _workbook -
_sheet
protected org.apache.poi.xssf.usermodel.XSSFSheet _sheet -
_columns
protected int _columns -
_rows
protected int _rows -
_currLine
protected int _currLine -
HEADERS
public static final int HEADERS- See Also:
-
NOHEADERS
public static final int NOHEADERS- See Also:
-
SKIPHEADERS
public static final int SKIPHEADERS- See Also:
-
MAXROWS
public static final int MAXROWS -
MAXCOLS
public static final int MAXCOLS -
TYPE_STRING
public static final int TYPE_STRING- See Also:
-
TYPE_DATE
public static final int TYPE_DATE- See Also:
-
TYPE_INTEGER
public static final int TYPE_INTEGER- See Also:
-
TYPE_FLOAT
public static final int TYPE_FLOAT- See Also:
-
-
Constructor Details
-
XlsxBufferedReader
Creates an instance of XlsxBufferedReader from anInputStream- Parameters:
is- TheInputStream- Throws:
IOException- if theInputStreamdoes not contain aXSSFWorkbook
-
-
Method Details
-
changeSheet
Changes the sheet- Parameters:
sheetName- The name of the sheet to change
-
close
Closes theXSSFWorkbook- Throws:
IOException- if an I/O error occurs
-
readCsvLine
Reads the CVS line- Returns:
- An ArrayList containing the CVS line
-
readCsvLine
Reads the CVS line- Parameters:
handler- TheXlsxBufferedReader.ExceptionHandler- Returns:
- An ArrayList containing the CVS line
-
toDBView
public DBView toDBView(int[] types, String[] formats, int headers, PrintStream ps) throws DAValidateException Returns the DBView representation of the Xlsx- Parameters:
types- The array of types, the lenght and the number of columns must be equalsformats- The array of formatsheaders- The headersps- ThePrintStream- Returns:
- The DBView representation of the Xlsx
- Throws:
DAValidateException- if the number of columns is not compatible, or the number of rows or columns excede the max number
-
main
- Throws:
Exception
-