APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.rowset.internal

public Class WebRowSetXmlWriter

extends Object
implements XmlWriter, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, javax.sql.rowset.spi.XmlWriter, javax.sql.RowSetWriter
Imports
com.sun.rowset.JdbcRowSetResourceBundle, java.sql.*, javax.sql.*, java.io.*, java.text.MessageFormat, java.util.*, javax.sql.rowset.*, javax.sql.rowset.spi.*

An implementation of the XmlWriter interface, which writes a WebRowSet object to an output stream as an XML document.

Field Summary

Modifier and TypeField and Description
private JdbcRowSetResourceBundle
pack-priv static final long
private Stack<String>
stack

The java.util.Stack object that this WebRowSetXmlWriter object will use for storing the tags to be used for writing the calling WebRowSet object as an XML document.

private transient Writer
writer

The java.io.Writer object to which this WebRowSetXmlWriter object will write when its writeXML method is called.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
private void
private void
private void
private void
private String
private String
processSpecialCharacters(String s)

This function has been added for the processing of special characters like <,>,'," and & in the data to be serialized.

private void
propBoolean(String tag, boolean b)

private void
propInteger(String tag, int i)

private void
private void
readObject(ObjectInputStream ois)

This method re populates the resBundle during the deserialization process

private void
private void
private void
private void
writeBoolean(boolean b)

private void
public boolean
writeData(RowSetInternal caller)

Implements javax.sql.RowSetWriter.writeData.

Purely for code coverage purposes..

private void
writeDouble(double d)

private void
private void
writeFloat(float f)

private void
writeIndent(int tabs)

private void
writeInteger(int i)

private void
writeLong(long l)

private void
private void
private void
private void
private void
writeShort(short s)

private void
private void
private void
writeValue(int idx, RowSet caller)

public void
writeXML(WebRowSet
the WebRowSet object to be written; must be a rowset for which this WebRowSetXmlWriter object is the writer
caller
,
Writer
the java.io.Writer object to which caller will be written
wrt
)

Implements javax.sql.rowset.spi.XmlWriter.writeXML.

Writes the given WebRowSet object as an XML document using the given java.io.Writer object.

public void
writeXML(WebRowSet
the WebRowSet object to be written; must be a rowset for which this WebRowSetXmlWriter object is the writer
caller
,
OutputStream
the java.io.OutputStream object to which caller will be written
oStream
)

Writes the given WebRowSet object as an XML document using the given java.io.OutputStream object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

resBundleback to summary
private JdbcRowSetResourceBundle resBundle
serialVersionUIDback to summary
pack-priv static final long serialVersionUID
stackback to summary
private Stack<String> stack

The java.util.Stack object that this WebRowSetXmlWriter object will use for storing the tags to be used for writing the calling WebRowSet object as an XML document.

writerback to summary
private transient Writer writer

The java.io.Writer object to which this WebRowSetXmlWriter object will write when its writeXML method is called. The value for this field is set with the java.io.Writer object given as the second argument to the writeXML method.

Constructor Detail

WebRowSetXmlWriterback to summary
public WebRowSetXmlWriter()

Method Detail

beginSectionback to summary
private void beginSection(String tag) throws IOException
beginTagback to summary
private void beginTag(String tag) throws IOException
emptyTagback to summary
private void emptyTag(String tag) throws IOException
endHeaderback to summary
private void endHeader() throws IOException
endSectionback to summary
private void endSection(String tag) throws IOException
endSectionback to summary
private void endSection() throws IOException
endTagback to summary
private void endTag(String tag) throws IOException
getTagback to summary
private String getTag()
processSpecialCharactersback to summary
private String processSpecialCharacters(String s)

This function has been added for the processing of special characters like <,>,'," and & in the data to be serialized. These have to be taken of specifically or else there will be parsing error while trying to read the contents of the XML file.

propBooleanback to summary
private void propBoolean(String tag, boolean b) throws IOException
propIntegerback to summary
private void propInteger(String tag, int i) throws IOException
propStringback to summary
private void propString(String tag, String s) throws IOException
readObjectback to summary
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException

This method re populates the resBundle during the deserialization process

setTagback to summary
private void setTag(String tag)
startHeaderback to summary
private void startHeader() throws IOException
writeBigDecimalback to summary
private void writeBigDecimal(BigDecimal bd) throws IOException
writeBooleanback to summary
private void writeBoolean(boolean b) throws IOException
writeDataback to summary
private void writeData(WebRowSet caller) throws IOException
Exceptions
SQLException:
if a database access error occurs
writeDataback to summary
public boolean writeData(RowSetInternal caller)

Implements javax.sql.RowSetWriter.writeData.

Purely for code coverage purposes..

writeDoubleback to summary
private void writeDouble(double d) throws IOException
writeEmptyStringback to summary
private void writeEmptyString() throws IOException
writeFloatback to summary
private void writeFloat(float f) throws IOException
writeIndentback to summary
private void writeIndent(int tabs) throws IOException
writeIntegerback to summary
private void writeInteger(int i) throws IOException
writeLongback to summary
private void writeLong(long l) throws IOException
writeMetaDataback to summary
private void writeMetaData(WebRowSet caller) throws IOException
Exceptions
SQLException:
if a database access error occurs
writeNullback to summary
private void writeNull() throws IOException
writePropertiesback to summary
private void writeProperties(WebRowSet caller) throws IOException
Exceptions
SQLException:
if a database access error occurs
writeRowSetback to summary
private void writeRowSet(WebRowSet caller) throws SQLException
Exceptions
SQLException:
if a database access error occurs
writeShortback to summary
private void writeShort(short s) throws IOException
writeStringback to summary
private void writeString(String s) throws IOException
writeStringDataback to summary
private void writeStringData(String s) throws IOException
writeValueback to summary
private void writeValue(int idx, RowSet caller) throws IOException
writeXMLback to summary
public void writeXML(WebRowSet caller, Writer wrt) throws SQLException

Implements javax.sql.rowset.spi.XmlWriter.writeXML.

Writes the given WebRowSet object as an XML document using the given java.io.Writer object. The XML document will include the WebRowSet object's data, metadata, and properties. If a data value has been updated, that information is also included.

This method is called by the XmlWriter object that is referenced in the calling WebRowSet object's xmlWriter field. The XmlWriter.writeXML method passes to this method the arguments that were supplied to it.

Parameters
caller:WebRowSet

the WebRowSet object to be written; must be a rowset for which this WebRowSetXmlWriter object is the writer

wrt:Writer

the java.io.Writer object to which caller will be written

Exceptions
SQLException:
if a database access error occurs or this WebRowSetXmlWriter object is not the writer for the given rowset
See Also
XmlWriter#writeXML
writeXMLback to summary
public void writeXML(WebRowSet caller, OutputStream oStream) throws SQLException

Writes the given WebRowSet object as an XML document using the given java.io.OutputStream object. The XML document will include the WebRowSet object's data, metadata, and properties. If a data value has been updated, that information is also included.

Using stream is a faster way than using java.io.Writer This method is called by the XmlWriter object that is referenced in the calling WebRowSet object's xmlWriter field. The XmlWriter.writeXML method passes to this method the arguments that were supplied to it.

Parameters
caller:WebRowSet

the WebRowSet object to be written; must be a rowset for which this WebRowSetXmlWriter object is the writer

oStream:OutputStream

the java.io.OutputStream object to which caller will be written

Exceptions
SQLException:
if a database access error occurs or this WebRowSetXmlWriter object is not the writer for the given rowset
See Also
XmlWriter#writeXML