|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.csv.CSVCondense
public final class CSVCondense
Remove blank lines and condense multiple spaces to one within fields. Trim lead and trail blanks on fields.
Use: java.exe com.mindprod.CSVCondense somefile.csv
Field Summary | |
---|---|
(package private) static java.util.regex.Pattern |
SPLITTER
used to split Label comment fields apart |
Constructor Summary | |
---|---|
CSVCondense(java.io.File file,
char separatorChar,
char quoteChar,
char commentChar,
java.lang.String encoding)
Condense a CSV file, constructor. |
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Simple command line interface to CSVCondense Condenses csv file whose name is on the command line. |
(package private) static java.lang.String |
rebuildLabelComment(java.lang.String comment)
comment has two lead comment chars, one stripped off, and are used to label the fields. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final java.util.regex.Pattern SPLITTER
Constructor Detail |
---|
public CSVCondense(java.io.File file, char separatorChar, char quoteChar, char commentChar, java.lang.String encoding) throws java.io.IOException
file
- CSV file to be packed to remove excess space and quotes.separatorChar
- field separator character, usually ',' in North America, ';' in Europe and sometimes '\t' for
tab.quoteChar
- char to use to enclose fields containing a separator, usually '\"'. Use (char)0 if
you don't want a quote character.commentChar
- char to use to introduce comments. Use (char) 0 if none. Only one character allowed.encoding
- encoding of input and output file.
java.io.IOException
- if problems reading/writing fileMethod Detail |
---|
static java.lang.String rebuildLabelComment(java.lang.String comment)
comment
- field names separated by commas, with lead comment char.
public static void main(java.lang.String[] args)
args
- name of csv file to remove excess space and blank lines
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |