|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.visualization.datasource.util.CsvDataSourceHelper
public class CsvDataSourceHelper
Helper class with static utility methods that are specific for building a data source based on CSV (Comma Separated Values) files. The main functionality is taking a CSV and generating a data table.
| Method Summary | |
|---|---|
static java.io.Reader |
getCsvFileReader(java.lang.String file)
Returns a Reader for the file. |
static java.io.Reader |
getCsvUrlReader(java.lang.String url)
Returns a Reader for the url. |
static DataTable |
read(java.io.Reader reader,
java.util.List<ColumnDescription> columnDescriptions,
java.lang.Boolean headerRow)
|
static DataTable |
read(java.io.Reader reader,
java.util.List<ColumnDescription> columnDescriptions,
java.lang.Boolean headerRow,
com.ibm.icu.util.ULocale locale)
Translates a CSV formatted input into a data table representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static DataTable read(java.io.Reader reader,
java.util.List<ColumnDescription> columnDescriptions,
java.lang.Boolean headerRow)
throws java.io.IOException,
CsvDataSourceException
java.io.IOException
CsvDataSourceExceptionread(java.io.Reader, java.util.List, Boolean, ULocale)
public static DataTable read(java.io.Reader reader,
java.util.List<ColumnDescription> columnDescriptions,
java.lang.Boolean headerRow,
com.ibm.icu.util.ULocale locale)
throws java.io.IOException,
CsvDataSourceException
reader - The CSV input Reader from which to read.columnDescriptions - The column descriptions.
If columnDescriptions is null, then it is assumed that all
values are strings, and the number of the columns is equal
to the number of the columns in the first line of the reader.
If headerRow is set to true, and the columnDescriptions does not
contain the labels of the columns, then the headerRow values are
used as the column labels.headerRow - True if there is an header row.
In that case, the first line of the csv is taken as the header row.locale - An optional locale in which to parse the input csv file.
If null, uses the default from LocaleUtil#getDefaultLocale.
java.io.IOException - In case of error reading from the reader.
CsvDataSourceException - In case of specific csv error.
public static java.io.Reader getCsvUrlReader(java.lang.String url)
throws DataSourceException
url - The url to get a Reader for.
DataSourceException - In case of a problem reading from the url.
public static java.io.Reader getCsvFileReader(java.lang.String file)
throws DataSourceException
file - The file to get a Reader for.
DataSourceException - In case of a problem reading from the file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||