public class CsvReaderApi extends CsvApiBase
| Modifier and Type | Field and Description |
|---|---|
static boolean |
CSV_CONTAIN_HEADERS |
CELLS_DEFAULT_SPLITTER, cellsSplitter, csvRows, filePath, headerList| Constructor and Description |
|---|
CsvReaderApi(String filePath)
Constructor.
|
CsvReaderApi(String filePath,
boolean isCsvContainHeaders)
Constructor.
|
CsvReaderApi(String filePath,
CellsSplitterEnum cellsSplitter)
Constructor.
|
CsvReaderApi(String filePath,
char cellsSplitter)
Constructor.
|
CsvReaderApi(String filePath,
char cellsSplitter,
boolean isCsvContainHeaders)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getColumn(String headerName)
Get column cells.
|
int |
getColumnIndex(String headerName)
Get column index that it's header is 'headerName'.
|
String |
getFieldValue(String headerName,
int rowIndex)
Get cell value.
|
List<String> |
getHeaderList()
Get header list.
|
String |
getPath()
Get CSV file path.
|
List<String> |
getRow(int index)
Get row in index.
|
int |
getRowIndex(String headerName,
String value)
Get row index thats it's column header is 'headerName', and cell in that column is 'value'.
|
List<List<String>> |
getRows()
Get rows not include headers row.
|
int |
getRowsAmount()
Get CSV rows amount.
|
boolean |
isCsvEmpty()
Return true if CSV not contain rows, Ignore headers line if exists.
|
public static final boolean CSV_CONTAIN_HEADERS
public CsvReaderApi(String filePath) throws IOException
filePath - CSV file path.IOException - in case fail read CSV file.public CsvReaderApi(String filePath, CellsSplitterEnum cellsSplitter) throws IOException
filePath - CSV file path.cellsSplitter - CSV cells splitter enum.IOException - in case fail read CSV file.public CsvReaderApi(String filePath, boolean isCsvContainHeaders) throws IOException
filePath - CSV file path.isCsvContainHeaders - true in case CSV file contain headers, else the value is false.IOException - in case fail read CSV file.public CsvReaderApi(String filePath, char cellsSplitter) throws IOException
filePath - CSV file path.cellsSplitter - Cells splitter char.IOException - in case fail read CSV file.public CsvReaderApi(String filePath, char cellsSplitter, boolean isCsvContainHeaders) throws IOException
filePath - CSV file path.cellsSplitter - CSV cells splitter char.isCsvContainHeaders - true in case CSV file contain headers, else the value is false.IOException - in case fail read CSV file.public int getRowsAmount()
public boolean isCsvEmpty()
public List<String> getHeaderList()
public int getColumnIndex(String headerName)
headerName - Header name.public int getRowIndex(String headerName, String value) throws IndexOutOfBoundsException
headerName - Header name.value - Field value.IndexOutOfBoundsException - In case column index exceed row.public List<String> getColumn(String headerName)
headerName - Header name.public String getFieldValue(String headerName, int rowIndex) throws io.github.tuzon.projects.core.expections.InvalidValueException, IndexOutOfBoundsException
headerName - Header name.rowIndex - Row index.io.github.tuzon.projects.core.expections.InvalidValueException - Row index is negative number.IndexOutOfBoundsException - Row index exceed of column size.public List<List<String>> getRows()
public List<String> getRow(int index) throws io.github.tuzon.projects.core.expections.InvalidValueException, IndexOutOfBoundsException
index - Row index not include headers row.io.github.tuzon.projects.core.expections.InvalidValueException - Index is negative number.IndexOutOfBoundsException - Index exceed of rows amount.public String getPath()
Copyright © 2019. All rights reserved.