|
jSyncManager | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jSyncManager.API.Protocol.Util.JSCSVDocument
A JSCSVDocument class to hold a CSV delimited document for use. Each "cell" in the record will be a double-quoted String, escaped if necessary.
JSCSVCell
,
DLPRecordCSV
Field Summary | |
---|---|
static int |
DATATYPE_ROW
|
static int |
DLPRECORD_COLS
|
(package private) int |
headerrows
|
static int |
TITLE_ROW
|
Constructor Summary | |
---|---|
JSCSVDocument()
Create a default empty JSCSVDocument type. |
|
JSCSVDocument(java.io.File document)
Create new JSCSVDocument with java.io.File document instance. |
|
JSCSVDocument(java.io.InputStreamReader inputfile)
Create new JSCSVDocument from an InputStreamReader stream. |
Method Summary | |
---|---|
protected JSCSVCell |
elementAt(int row,
int col)
Get a JSCSVCell object at the row,col given. |
java.lang.String |
escape(byte in)
Escapes any html characters in the input byte. |
java.lang.String[] |
escape(byte[] in)
Escapes any html characters in the input byte array. |
java.lang.String |
escape(char in)
Escapes any html characters in the input char. |
java.lang.String[] |
escape(char[] in)
Escapes any html characters in the input char array. |
java.lang.String |
escape(double in)
Escapes any html characters in the input double value. |
java.lang.String[] |
escape(double[] in)
Escapes any html characters in the input double array value. |
java.lang.String |
escape(float in)
Escapes any html characters in the input float value. |
java.lang.String[] |
escape(float[] in)
Escapes any html characters in the input float array value. |
java.lang.String |
escape(int in)
Escapes any html characters in the input int. |
java.lang.String[] |
escape(int[] in)
Escapes any html characters in the input int array. |
java.lang.String |
escape(long in)
Escapes any html characters in the input long value. |
java.lang.String[] |
escape(long[] in)
Escapes any html characters in the input long array. |
java.lang.String |
escape(java.lang.String in)
Escapes any html characters in the input string. |
JSCSVCell |
getCell(int row,
int col)
Retrieve the JSCSVCell object from the given row and column. |
java.util.Vector |
getDocument()
Getter for property document. |
int |
getHeaderrows()
Getter for property headerrows. |
java.io.BufferedReader |
getReader()
Getter for property reader. |
int |
getRowNo(int recordno)
Get current internal Row number taken from given record number plus the number of header rows. |
java.lang.String |
getSeparator()
Getter for property separator which separates the columns in each row in the document. |
java.lang.String |
getValue(int row,
int col)
Retrieve the String value from the JSCSVCell at the given row and column. |
boolean |
isShowtitles()
Get boolean value showing whether the titles should be shown in the output document or not. |
protected void |
parse()
Parse the document and insert elements as needed. |
void |
parse(java.io.BufferedReader input)
Parse the document from the input BufferedReader stream and insert elements as needed. |
void |
parse(java.io.File input)
Parse the document from the input java.io.File and insert elements as needed. |
void |
parse(java.io.InputStreamReader input)
Parse a CSV style document from the input InputStreamReader stream and insert elements as needed. |
protected void |
parseRow(java.lang.String line)
Parse the data values for the next row. |
protected void |
parseTitleRow(java.lang.String line)
Parse the titles for the TITLE_ROW row of the document. |
protected void |
parseTypeRow(java.lang.String line)
Parse the data types from the DATATYPE_ROW row String given. |
boolean |
readBooleanCell(JSCSVCell node)
Get boolean value of node JSCSVCell object. |
byte[] |
readByteArrayCell(JSCSVCell node)
Get byte array value of node JSCSVCell object. |
byte |
readByteCell(JSCSVCell node)
Get byte value of node JSCSVCell object. |
java.util.GregorianCalendar |
readCalendarCell(JSCSVCell node)
Get GregorianCalendar value of node JSCSVCell object. |
char[] |
readCharArrayCell(JSCSVCell node)
Get char array value of node JSCSVCell object. |
char |
readCharCell(JSCSVCell node)
Get char value of node JSCSVCell object. |
void |
readDocument(java.io.InputStreamReader inputfile)
Read and parse the contents from an InputStreamReader stream. |
double[] |
readDoubleArrayCell(JSCSVCell node)
Get double array value of node JSCSVCell object. |
double |
readDoubleCell(JSCSVCell node)
Get double value of node JSCSVCell object. |
float[] |
readFloatArrayCell(JSCSVCell node)
Get float array value of node JSCSVCell object. |
float |
readFloatCell(JSCSVCell node)
Get float value of node JSCSVCell object. |
int[] |
readIntArrayCell(JSCSVCell node)
Get int array value of node JSCSVCell object. |
int |
readIntCell(JSCSVCell node)
Get int value of node JSCSVCell object. |
long[] |
readLongArrayCell(JSCSVCell node)
Get long array value of node JSCSVCell object. |
long |
readLongCell(JSCSVCell node)
Get long value of node JSCSVCell object. |
java.lang.String[] |
readStringArrayCell(JSCSVCell node)
Get String array value of node JSCSVCell object. |
java.lang.String |
readStringCell(JSCSVCell node)
Get String value of node JSCSVCell object. |
void |
setDocument(java.util.Vector document)
Setter for property document. |
protected void |
setElementAt(JSCSVCell cell,
int row,
int col)
Set a JSCSVCell object at the row,col given. |
protected void |
setElementAt(JSCSVCell cell,
java.lang.String title,
int row,
int col)
Set a JSCSVCell object at the row,col given with the given title String. |
void |
setHeaderrows()
Setter for property headerrows. |
void |
setReader(java.io.BufferedReader reader)
Setter for property reader. |
void |
setReader(java.io.File file)
Setter for property reader from java.io.File instance. |
void |
setReader(java.io.InputStreamReader reader)
Setter for property reader. |
void |
setSeparator(java.lang.String separator)
Setter for property separator which separates the columns in each row in the document. |
void |
setShowtitles(boolean showtitles)
Setter for property showtitles with boolean value showing whether the titles should be shown in the output document or not. |
void |
writeDataRow(java.io.BufferedWriter outputfile,
int row)
Write the document row at the given index row to the given BufferedWriter stream. |
void |
writeDocument(java.io.BufferedWriter outputfile)
Write the current document to the given BufferedWriter stream. |
void |
writeDocument(java.io.OutputStreamWriter outputfile)
Write the current document to the given OutputStreamWriter stream. |
Methods inherited from class java.lang.Object |
---|
|
Field Detail |
int headerrows
public static final int DATATYPE_ROW
public static final int TITLE_ROW
public static final int DLPRECORD_COLS
Constructor Detail |
public JSCSVDocument()
public JSCSVDocument(java.io.File document) throws java.io.IOException
document
- External File object to be parsed into the document.java.io.IOException
- public JSCSVDocument(java.io.InputStreamReader inputfile) throws java.io.IOException
inputfile
- InputStreamReader stream to parse the document contents from.java.io.IOException
- Method Detail |
public void readDocument(java.io.InputStreamReader inputfile) throws java.io.IOException
inputfile
- InputStreamReader stream to parse the document contents from.java.io.IOException
- protected void setElementAt(JSCSVCell cell, int row, int col)
cell
- JSCSVCell type value to insert into the document.row
- Row number (index starts at 0) to insert the cell.col
- Column number (index starts at 0) to insert the cell.protected void setElementAt(JSCSVCell cell, java.lang.String title, int row, int col)
cell
- JSCSVCell type value to insert into the document.title
- String value of title row for this column.row
- Row number (index starts at 0) to insert the cell.col
- Column number (index starts at 0) to insert the cell.protected JSCSVCell elementAt(int row, int col) throws java.lang.ArrayIndexOutOfBoundsException
row
- Row number (index starts at 0) to insert the cell.col
- Column number (index starts at 0) to insert the cell.ArraIndexOutOfBoundException
- Thrown if the row,col given is outside the boundaries of the current document's values.protected void parse() throws java.io.IOException
java.io.IOException
- public void parse(java.io.BufferedReader input) throws java.io.IOException
input
- BufferedReader stream to be parsed.java.io.IOException
- public void parse(java.io.InputStreamReader input) throws java.io.IOException
input
- InputStreamReader stream to be parsed.java.io.IOException
- public void parse(java.io.File input) throws java.io.FileNotFoundException, java.io.IOException
input
- File object to be parsed.java.io.FileNotFoundException
- java.io.IOException
- protected void parseTypeRow(java.lang.String line)
line
- String value of the DATATYPE_ROW.protected void parseTitleRow(java.lang.String line)
line
- String value of the TITLE_ROW.protected void parseRow(java.lang.String line)
line
- String value of the row values separated by commas.public JSCSVCell getCell(int row, int col)
row
- Row number of the desired cell.col
- Column number of the desired cell.public java.lang.String getValue(int row, int col)
row
- Row number of the desired cell.col
- Column number of the desired cell.public void writeDocument(java.io.OutputStreamWriter outputfile) throws java.io.IOException
outputfile
- OutputStreamWriter to output the document to.java.io.IOException
- public void writeDocument(java.io.BufferedWriter outputfile) throws java.io.IOException
outputfile
- BufferedWriter to output the document to.java.io.IOException
- public void writeDataRow(java.io.BufferedWriter outputfile, int row) throws java.io.IOException
outputfile
- BufferedWriter to output the document to.java.io.IOException
- public java.util.Vector getDocument()
public void setDocument(java.util.Vector document)
document
- New Vector value of property document contents.public java.lang.String readStringCell(JSCSVCell node)
node
- JSCSVCell to get value from.public java.lang.String[] readStringArrayCell(JSCSVCell node)
node
- JSCSVCell to get value from.public java.util.GregorianCalendar readCalendarCell(JSCSVCell node) throws java.text.ParseException
node
- JSCSVCell to get value from.java.text.ParseException
- Thrown if the cell contents are NOT a Calendar type.public boolean readBooleanCell(JSCSVCell node)
node
- JSCSVCell to get value from.public byte readByteCell(JSCSVCell node)
node
- JSCSVCell to get value from.public byte[] readByteArrayCell(JSCSVCell node)
node
- JSCSVCell to get value from.public char readCharCell(JSCSVCell node)
node
- JSCSVCell to get value from.public char[] readCharArrayCell(JSCSVCell node)
node
- JSCSVCell to get value from.public int readIntCell(JSCSVCell node)
node
- JSCSVCell to get value from.public int[] readIntArrayCell(JSCSVCell node)
node
- JSCSVCell to get value from.public long readLongCell(JSCSVCell node)
node
- JSCSVCell to get value from.public long[] readLongArrayCell(JSCSVCell node)
node
- JSCSVCell to get value from.public float readFloatCell(JSCSVCell node)
node
- JSCSVCell to get value from.public float[] readFloatArrayCell(JSCSVCell node)
node
- JSCSVCell to get value from.public double readDoubleCell(JSCSVCell node)
node
- JSCSVCell to get value from.public double[] readDoubleArrayCell(JSCSVCell node)
node
- JSCSVCell to get value from.public java.lang.String escape(java.lang.String in)
in
- String value to replace escape values for.public java.lang.String escape(byte in)
in
- byte value to replace escape values for.public java.lang.String[] escape(byte[] in)
in
- byte array value to replace escape values for.public java.lang.String escape(char in)
in
- char value to replace escape values for.public java.lang.String[] escape(char[] in)
in
- char array value to replace escape values for.public java.lang.String escape(int in)
in
- int value to replace escape values for.public java.lang.String[] escape(int[] in)
in
- int array value to replace escape values for.public java.lang.String escape(long in)
in
- long value to replace escape values for.public java.lang.String[] escape(long[] in)
in
- long array value to replace escape values for.public java.lang.String escape(float in)
in
- float value to replace escape values for.public java.lang.String[] escape(float[] in)
in
- float array value to replace escape values for.public java.lang.String escape(double in)
in
- double value to replace escape values for.public java.lang.String[] escape(double[] in)
in
- double array value to replace escape values for.public java.io.BufferedReader getReader()
public void setReader(java.io.BufferedReader reader)
reader
- New value of property reader.public void setReader(java.io.InputStreamReader reader)
reader
- New value of property reader.public void setReader(java.io.File file) throws java.io.FileNotFoundException
reader
- New value of property reader.public java.lang.String getSeparator()
public void setSeparator(java.lang.String separator)
separator
- New value of property separator.public boolean isShowtitles()
public void setShowtitles(boolean showtitles)
showtitles
- New value of property showtitles.public int getHeaderrows()
public void setHeaderrows()
headerrows
- Number of header rows to include.public int getRowNo(int recordno)
|
jSyncManager | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |