org.gcube.portlets.user.td.gwtservice.shared.csv
Class CSVFileUtil
java.lang.Object
org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil
public class CSVFileUtil
- extends Object
- Author:
- "Giancarlo Panichi"
g.panichi@isti.cnr.it
|
Field Summary |
protected static org.slf4j.Logger |
logger
|
|
Method Summary |
static ArrayList<CSVRowError> |
checkCSV(File csvFile,
Charset charset,
char delimiter,
char comment,
long errorsLimit)
|
static ArrayList<CSVRowError> |
checkCSV(File csvFile,
CSVParserConfiguration config,
long errorsLimit)
|
protected static net.sf.csv4j.CSVReader |
createCSVReader(File csvFile,
CSVParserConfiguration parserConfiguration)
|
static List<String> |
getFirstLine(net.sf.csv4j.CSVReader csvReader,
boolean includeComment)
|
static ArrayList<String> |
getHeader(File csvFile,
CSVParserConfiguration parserConfiguration)
|
static String |
guessEncoding(File file)
|
static void |
toJson(File csvFile,
Charset inputCharset,
File outputFile,
Charset outputCharset,
HeaderPresence headerPresence,
char delimiter,
char comment,
long limit)
|
static void |
toJson(InputStream csv,
Charset inputCharset,
OutputStream output,
Charset outputCharset,
HeaderPresence headerPresence,
char delimiter,
char comment,
long limit)
|
static void |
toJson(InputStream csv,
OutputStream output,
Charset outputCharset,
CSVParserConfiguration config,
long limit)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected static org.slf4j.Logger logger
CSVFileUtil
public CSVFileUtil()
getHeader
public static ArrayList<String> getHeader(File csvFile,
CSVParserConfiguration parserConfiguration)
throws net.sf.csv4j.ParseException,
IOException
- Throws:
net.sf.csv4j.ParseException
IOException
getFirstLine
public static List<String> getFirstLine(net.sf.csv4j.CSVReader csvReader,
boolean includeComment)
throws net.sf.csv4j.ParseException,
IOException
- Throws:
net.sf.csv4j.ParseException
IOException
createCSVReader
protected static net.sf.csv4j.CSVReader createCSVReader(File csvFile,
CSVParserConfiguration parserConfiguration)
throws FileNotFoundException
- Throws:
FileNotFoundException
checkCSV
public static ArrayList<CSVRowError> checkCSV(File csvFile,
CSVParserConfiguration config,
long errorsLimit)
throws net.sf.csv4j.ParseException,
IOException
- Throws:
net.sf.csv4j.ParseException
IOException
checkCSV
public static ArrayList<CSVRowError> checkCSV(File csvFile,
Charset charset,
char delimiter,
char comment,
long errorsLimit)
throws IOException
- Throws:
IOException
toJson
public static void toJson(File csvFile,
Charset inputCharset,
File outputFile,
Charset outputCharset,
HeaderPresence headerPresence,
char delimiter,
char comment,
long limit)
throws net.sf.csv4j.ParseException,
IOException
- Throws:
net.sf.csv4j.ParseException
IOException
toJson
public static void toJson(InputStream csv,
OutputStream output,
Charset outputCharset,
CSVParserConfiguration config,
long limit)
throws net.sf.csv4j.ParseException,
IOException
- Throws:
net.sf.csv4j.ParseException
IOException
toJson
public static void toJson(InputStream csv,
Charset inputCharset,
OutputStream output,
Charset outputCharset,
HeaderPresence headerPresence,
char delimiter,
char comment,
long limit)
throws net.sf.csv4j.ParseException,
IOException
- Throws:
net.sf.csv4j.ParseException
IOException
guessEncoding
public static String guessEncoding(File file)
throws IOException
- Throws:
IOException
Copyright © 2013. All Rights Reserved.