|
Copyright © 2008-2011 Ralph Schuster. All Rights Reserved. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcsv.impl.AbstractTableWriter
csv.impl.AbstractStreamTableWriter
csv.impl.XmlWriter
public class XmlWriter
Writer implementation for XML streams.
| Constructor Summary | |
|---|---|
XmlWriter()
Constructor. |
|
XmlWriter(java.io.File file)
Constructor. |
|
XmlWriter(java.io.File file,
boolean writeHeaderRow)
Constructor. |
|
XmlWriter(java.io.OutputStream out)
Constructor. |
|
XmlWriter(java.io.OutputStream out,
boolean writeHeaderRow)
Constructor. |
|
XmlWriter(java.lang.String file)
Constructor. |
|
XmlWriter(java.lang.String file,
boolean writeHeaderRow)
Constructor. |
|
| Method Summary | |
|---|---|
void |
close()
Prints the closing of the XML file before closing the stream. |
protected java.lang.String |
encode(java.lang.Object s)
Encodes the object for usage in XML file. |
protected java.lang.String |
getColumnEndTag(int column)
Returns column's closing tag |
protected java.lang.String |
getColumnName(int index)
Returns the column name at given index. |
java.lang.String |
getColumnNameAttribute()
Returns the name of the attribute within column tag that contains the column name. |
protected java.lang.String |
getColumnStartTag(int column,
java.lang.Object value)
Returns the complete start tag for the column. |
protected java.lang.String |
getColumnTagAttributes(int column,
java.lang.Object value)
Returns all attributes that need to be set for a column opening tag. |
java.lang.String |
getColumnTagName()
Returns the name of the column tag. |
protected java.lang.String |
getColumnTagName(int column)
Returns correct column name. |
protected java.lang.String |
getColumnType(java.lang.Object value)
Returns the type of the value to be set as attribute in column opening tag. |
java.lang.String |
getColumnTypeAttribute()
Returns the name of the attribute in the column tag that contains the Java type of the value. |
protected java.lang.String |
getDefaultColumnName(int index)
Creates a default name for the column. |
java.lang.String |
getEncoding()
Returns the encoding string for XML header. |
java.lang.Object[] |
getHeaderColumns()
Returns the header column names. |
java.lang.String |
getRowTagName()
Returns the name of the row tag. |
java.lang.String |
getTopLevelTagName()
Returns the XML root tag name. |
protected void |
init()
Initializes the writer. |
boolean |
isUseColumnNameTags()
Returns whether column tag names will be equal to column names. |
boolean |
isWriteHeaderRow()
Returns true when the first row being written contains the column names. |
void |
printComment(java.lang.String comment)
Prints the comment into the stream. |
void |
printComment(java.lang.String comment,
int row,
int column)
Prints the comment at the given location. |
protected void |
printFooter()
Prints the footer. |
protected void |
printHeader()
Prints the header. |
void |
printRow(java.lang.Object[] columns)
Prints the row into the stream. |
void |
setColumnNameAttribute(java.lang.String columnNameAttribute)
Sets the name of the attribute within column tag that contains the column name. |
void |
setColumnTagName(java.lang.String columnTagName)
Sets the name of teh column tag. |
void |
setColumnTypeAttribute(java.lang.String columnTypeAttribute)
Sets the name of the attribute in the column tag that contains the Java type of the value. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding string for XML header. |
void |
setHeaderColumns(java.lang.Object[] headerColumns)
Sets the header column names explicitely. |
void |
setRowTagName(java.lang.String rowTagName)
Set the name of the row tag. |
void |
setTopLevelTagName(java.lang.String topLevelTagName)
Sets the XML root tag name. |
void |
setUseColumnNameTags(boolean useColumnNameTags)
Sets whether column tag names will be equal to column names. |
void |
setWriteHeaderRow(boolean writeHeaderRow)
Sets whether the first row being written contains the column names. |
| Methods inherited from class csv.impl.AbstractStreamTableWriter |
|---|
getOutputStream, getWriter, setOutputStream |
| Methods inherited from class csv.impl.AbstractTableWriter |
|---|
convert, convert, getRowCount, getTypeConversionHandler, incrementRowCount, registerTypeConversionHandler, unregisterTypeConversionHandler |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlWriter()
public XmlWriter(java.io.OutputStream out)
out - output stream
public XmlWriter(java.io.OutputStream out,
boolean writeHeaderRow)
out - output streamwriteHeaderRow - whether a dedicated header row will be received as first row
public XmlWriter(java.io.File file)
throws java.io.IOException
file - output file
java.io.IOException - if exception occurs
public XmlWriter(java.io.File file,
boolean writeHeaderRow)
throws java.io.IOException
file - output filewriteHeaderRow - whether a dedicated header row will be received as first row
java.io.IOException - if exception occurs
public XmlWriter(java.lang.String file)
throws java.io.IOException
file - file to write
java.io.IOException - if exception occurs
public XmlWriter(java.lang.String file,
boolean writeHeaderRow)
throws java.io.IOException
file - file to writewriteHeaderRow - whether a dedicated header row will be received as first row
java.io.IOException - if exception occurs| Method Detail |
|---|
public void close()
close in interface TableWriterclose in class AbstractStreamTableWriterAbstractStreamTableWriter.close()protected void init()
init in class AbstractTableWriterAbstractTableWriter.init()
public void printRow(java.lang.Object[] columns)
throws java.io.IOException
setWriteHeaderRow(boolean) was set.
columns - columns to be written in row
java.io.IOException - when an exception occursTableWriter.printRow(java.lang.Object[])
protected java.lang.String getColumnStartTag(int column,
java.lang.Object value)
column - index of columnvalue - value in column
protected java.lang.String getColumnEndTag(int column)
column - column index
protected java.lang.String getColumnTagName(int column)
column - index of column
isUseColumnNameTags()
protected java.lang.String getColumnTagAttributes(int column,
java.lang.Object value)
column - index of columnvalue - value of column
protected java.lang.String getColumnType(java.lang.Object value)
value - value of column
public void printComment(java.lang.String comment)
throws java.io.IOException
printComment in interface TableWriterprintComment in class AbstractTableWritercomment - the comment to write
java.io.IOException - when an exception occursAbstractTableWriter.printComment(java.lang.String)
public void printComment(java.lang.String comment,
int row,
int column)
throws java.io.IOException
printComment in interface TableWriterprintComment in class AbstractTableWritercomment - the comment to writerow - index of row for commentcolumn - index of column for comment
java.io.IOException - when an exception occursAbstractTableWriter.printComment(java.lang.String, int, int)protected void printHeader()
protected void printFooter()
protected java.lang.String encode(java.lang.Object s)
s - object to encode
protected java.lang.String getColumnName(int index)
getDefaultColumnName(int) if no column header can be found.
index - index of column
protected java.lang.String getDefaultColumnName(int index)
index - index of column
public java.lang.String getTopLevelTagName()
public void setTopLevelTagName(java.lang.String topLevelTagName)
topLevelTagName - the topLevelTagName to setpublic java.lang.String getRowTagName()
public void setRowTagName(java.lang.String rowTagName)
rowTagName - the rowTagName to setpublic java.lang.String getColumnTagName()
setUseColumnNameTags(boolean) was not set.
public void setColumnTagName(java.lang.String columnTagName)
setUseColumnNameTags(boolean) was not set.
columnTagName - the columnTagName to setpublic boolean isUseColumnNameTags()
public void setUseColumnNameTags(boolean useColumnNameTags)
useColumnNameTags - the useColumnNameTags to setpublic java.lang.String getColumnNameAttribute()
setUseColumnNameTags(boolean) was not set.
public void setColumnNameAttribute(java.lang.String columnNameAttribute)
setUseColumnNameTags(boolean) was not set.
columnNameAttribute - the columnNameAttribute to setpublic java.lang.String getColumnTypeAttribute()
public void setColumnTypeAttribute(java.lang.String columnTypeAttribute)
columnTypeAttribute - the columnTypeAttribute to setpublic java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
encoding - the encoding to setpublic java.lang.Object[] getHeaderColumns()
public void setHeaderColumns(java.lang.Object[] headerColumns)
headerColumns - the headerColumns to setpublic boolean isWriteHeaderRow()
public void setWriteHeaderRow(boolean writeHeaderRow)
writeHeaderRow - the writeHeaderRow to set
|
Copyright © 2008-2011 Ralph Schuster. All Rights Reserved. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||