public class CsvFile
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CsvFile.Line
A line in a CSV-file.
|
static interface |
CsvFile.LineFilter |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL_BLOCKS
Special block-name for reading default block and cache all others.
|
static java.lang.String |
BLOCK_INDICATOR
Indicates start of block inside a CSV file.
|
Constructor and Description |
---|
CsvFile(java.io.File csvFile)
Constructor.
|
CsvFile(java.io.File csvFile,
CsvFile.LineFilter filter)
Constructor.
|
CsvFile(java.io.File csvFile,
java.lang.String block)
Constructor.
|
CsvFile(java.io.File csvFile,
java.lang.String block,
CsvFile.LineFilter filter)
Constructor.
|
CsvFile(java.io.InputStream in,
java.lang.String block,
java.lang.String location,
CsvFile.LineFilter filter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.lang.String[] line)
Checks if a certain line can be found in this file.
|
static java.lang.String[] |
decodeLine(java.lang.String line)
Decodes and splits csv-line.
|
static java.lang.String |
encodeCell(java.lang.String cell)
Encodes and csv-cell.
|
java.util.List<CsvFile.Line> |
getLines()
Gets the list of lines.
|
java.util.List<CsvFile.Line> |
getLines(java.lang.String block)
Gets the list of lines of a cached block.
|
public static java.lang.String BLOCK_INDICATOR
public static final java.lang.String ALL_BLOCKS
getLines()
,
Constant Field Valuespublic CsvFile(java.io.File csvFile) throws java.io.IOException
csvFile
- the csv filejava.io.IOException
public CsvFile(java.io.File csvFile, CsvFile.LineFilter filter) throws java.io.IOException
csvFile
- the csv filejava.io.IOException
public CsvFile(java.io.File csvFile, java.lang.String block) throws java.io.IOException
csvFile
- the csv fileblock
- the block to read, null
to read default blockjava.io.IOException
public CsvFile(java.io.File csvFile, java.lang.String block, CsvFile.LineFilter filter) throws java.io.IOException
csvFile
- the csv fileblock
- the block to read, null
to read default blockjava.io.IOException
public CsvFile(java.io.InputStream in, java.lang.String block, java.lang.String location, CsvFile.LineFilter filter) throws java.io.IOException
in
- to read fromblock
- the block to read, null
to read default blockjava.io.IOException
public static java.lang.String[] decodeLine(java.lang.String line)
line
- the line to decodepublic static java.lang.String encodeCell(java.lang.String cell)
cell
- the cell to encodepublic java.util.List<CsvFile.Line> getLines()
public java.util.List<CsvFile.Line> getLines(java.lang.String block)
ALL_BLOCKS
public boolean contains(java.lang.String[] line)
line
- the linetrue
iff this file contains the line