|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart2djava.ChartObj
com.quinncurtis.chart2djava.CSV
public class CSV
The DChartCSV class provides utility routines and constants used to read/write CSV (comma separated value) files. CSV files allow data to be exchanged with other programs that read and write CSV files, such as work processors and spreadsheets.
Field Summary |
---|
Constructor Summary | |
---|---|
CSV()
The default DChartCSV constructor. |
|
CSV(int orient)
This CSV constructor specifies the orientation of the data values in the source or target data file. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
char |
getColumnDelimiterChar()
This methods returns the column delimiter character. |
int |
getFileNumColumns(java.io.Reader pReader)
This method counts the number of columns in a CSV file. |
int |
getFileNumRows(java.io.Reader pReader)
This method counts the number of rows in a CSV file. |
java.lang.String |
getNewLineString()
This methods returns the newline string. |
int |
getOrientation()
Returns the current orientation of the data file. |
java.text.SimpleDateFormat |
getTimeDateFormat()
A time date format in the form of a SimpleDateFormat object controls how GregorianCalendar values are written to or read from the target file. |
java.lang.String |
read(java.io.Reader pReader)
This method reads one string from the specified Reader object. |
double |
readDouble(java.io.Reader pReader)
This method reads a double value from the specified Reader object. |
void |
readln(java.io.Reader pReader)
Skip over remaining fields on this line you don't want to process. |
long |
readLong(java.io.Reader pReader)
This method reads a long value from the specified Reader object. |
java.util.GregorianCalendar |
readTime(java.io.Reader pReader)
This method reads a GregorianCalendar date from the specified Reader object. |
void |
setColumnDelimiterChar(char c)
This methods sets the column delimiter character, which is a comma by default. |
void |
setNewLineString(java.lang.String s)
This methods sets the newline string, which is a "\r\n" by default. |
void |
setOrientation(int orient)
Controls the row/column orientation of the data file as it relates to conversion into an DChartDataset derived object. |
void |
setTimeDateFormat(java.text.SimpleDateFormat format)
A time date format in the form of a SimpleDateFormat object controls how GregorianCalendar values are written to or read from the target file. |
void |
skip(java.io.Reader pReader,
int fields)
This method skips over fields that do not need to be processed. |
void |
write(java.io.PrintWriter pWriter,
java.lang.String s)
This method write a string to the specified PrintWriter object. |
void |
writeDouble(java.io.PrintWriter pWriter,
double r)
This method write a double value to the specified PrintWriter object. |
void |
writeln(java.io.PrintWriter pWriter)
This method starts a new line by writing the newLineString character to the specified PrintWriter object. |
void |
writeLong(java.io.PrintWriter pWriter,
long l)
This method write a long value to the specified PrintWriter object. |
void |
writeTime(java.io.PrintWriter pWriter,
java.util.GregorianCalendar gregdate)
This method write a GregorianCalendar value to the specified PrintWriter object. |
Methods inherited from class com.quinncurtis.chart2djava.ChartObj |
---|
copy, errorCheck, getChartObjIDCntr, getChartObjType, getThisChartObjID, TypeSafeVectorCopy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CSV()
public CSV(int orient)
orient
- Controls the row/column orientation of the data file as it relates to conversion
into an DChartDataset derived object. The file can be organized so that
the columns represent groups and the rows represent data values for
each group (COLUMN_MAJOR), or the where the rows represent groups
and the columns represent data values for each group (ROW_MAJOR).Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public char getColumnDelimiterChar()
public int getFileNumColumns(java.io.Reader pReader)
pReader
- A previously opened Reader object.
public int getFileNumRows(java.io.Reader pReader)
pReader
- A previously opened Reader object.
public java.lang.String getNewLineString()
public int getOrientation()
public java.text.SimpleDateFormat getTimeDateFormat()
public java.lang.String read(java.io.Reader pReader) throws java.io.EOFException, java.io.IOException
pReader
- A previously opened Reader object.
java.io.EOFException
- at end of file after all the fields have
been read.
java.io.IOException
- Some problem reading the file, possibly malformed data.public double readDouble(java.io.Reader pReader) throws java.io.EOFException, java.io.IOException
pReader
- A previously opened Reader object.
java.io.EOFException
- at end of file after all the fields have
been read.
java.io.IOException
- Some problem reading the file, possibly malformed data.public void readln(java.io.Reader pReader) throws java.io.EOFException, java.io.IOException
pReader
- A previously opened Reader object.
java.io.EOFException
- at end of file after all the fields have
been read.
java.io.IOException
- Some problem reading the file, possibly malformed data.public long readLong(java.io.Reader pReader) throws java.io.EOFException, java.io.IOException
pReader
- A previously opened Reader object.
java.io.EOFException
- at end of file after all the fields have
been read.
java.io.IOException
- Some problem reading the file, possibly malformed data.public java.util.GregorianCalendar readTime(java.io.Reader pReader) throws java.io.EOFException, java.io.IOException
pReader
- A previously opened Reader object.
java.io.EOFException
- at end of file after all the fields have
been read.
java.io.IOException
- Some problem reading the file, possibly malformed data.public void setColumnDelimiterChar(char c)
c
- The new comma delimiter character.public void setNewLineString(java.lang.String s)
s
- The new newline string.public void setOrientation(int orient)
orient
- Set to COLUMN_MAJOR or ROW_MAJOR.public void setTimeDateFormat(java.text.SimpleDateFormat format)
format
- An instance of a SimpleDateFormat object, initialized
for the desired format.public void skip(java.io.Reader pReader, int fields) throws java.io.EOFException, java.io.IOException
pReader
- A previously opened Reader object.fields
- How many field you want to bypass reading.
The newline counts as one field.
java.io.EOFException
- at end of file after all the fields have
been read.
java.io.IOException
- Some problem reading the file, possibly malformed data.public void write(java.io.PrintWriter pWriter, java.lang.String s)
pWriter
- A previously opened PrintWriter object.s
- The string that is to written to a file.public void writeDouble(java.io.PrintWriter pWriter, double r)
pWriter
- A previously opened PrintWriter object.r
- The double value that is to written to a file.public void writeln(java.io.PrintWriter pWriter)
pWriter
- A previously opened PrintWriter object.public void writeLong(java.io.PrintWriter pWriter, long l)
pWriter
- A previously opened PrintWriter object.l
- The long value that is to written to a file.public void writeTime(java.io.PrintWriter pWriter, java.util.GregorianCalendar gregdate)
pWriter
- A previously opened PrintWriter object.gregdate
- The GregorianCalendar date that is to written to a file.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |