Package overit.geocall.util
Class XLSBufferedReader
java.lang.Object
overit.geocall.util.XLSBufferedReader
This class is an utility implementation that must be used if you want to read
the contents of a XLS from an InputStream
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intprotected org.apache.poi.hssf.usermodel.HSSFSheetprotected org.apache.poi.hssf.usermodel.HSSFWorkbookprotected static final HashMap<String, SimpleDateFormat> static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of XLSBufferedReader from anInputStreamXLSBufferedReader(InputStream is, String sheetname) Creates an instance of XLSBufferedReader from anInputStreamand a name of the sheet -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeSheet(String sheetName) Changes the sheetvoidclose()Closes theHSSFWorkbookReads the CVS lineReads the CVS linetoDBView(int[] types, String[] formats, int headers, PrintStream ps) Returns the DBView representation of the XLS
-
Field Details
-
CONVERT_FORMATS
-
_workbook
protected org.apache.poi.hssf.usermodel.HSSFWorkbook _workbook -
_sheet
protected org.apache.poi.hssf.usermodel.HSSFSheet _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
-
XLSBufferedReader
Creates an instance of XLSBufferedReader from anInputStream- Parameters:
is- TheInputStream- Throws:
IOException- if theInputStreamdoes not contain aHSSFWorkbook
-
XLSBufferedReader
Creates an instance of XLSBufferedReader from anInputStreamand a name of the sheet- Parameters:
is- TheInputStreamsheetname- The name of the sheet- Throws:
IOException- if theInputStreamdoes not contain aHSSFWorkbook
-
-
Method Details
-
changeSheet
Changes the sheet- Parameters:
sheetName- The name of the sheet to change
-
close
Closes theHSSFWorkbook- 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- TheXLSBufferedReader.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 XLS- 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 XLS
- Throws:
DAValidateException- if the number of columns is not compatible, or the number of rows or columns excede the max number
-