|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.xtvdclient.xtvd.parser.ParserFactory
public final class ParserFactory
A factory class that is used to return appropriate instances of
Parser
.
AbstractParser
,
WriterParser
Method Summary | |
---|---|
static Parser |
getWriterParser(java.io.Reader in,
java.io.Writer out)
Return a Parser that will parse the XTVD XML
document from the specified Reader and write
the results to the specified Writer . |
static Parser |
getXtvdParser(java.io.Reader in,
Xtvd xtvd)
Return a Parser that will parse the XTVD XML
document from the specified Reader and create
a Xtvd object that represents all the data contained in
the XML. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final Parser getWriterParser(java.io.Reader in, java.io.Writer out) throws DataDirectException
Parser
that will parse the XTVD XML
document
from the specified Reader
and write
the results to the specified Writer
.
The following code sample shows a way of using this method:
BufferedReader reader = new BufferedReader( new InputStreamReader( new GZIPInputStream( httpConnection.getInputStream() ), "UTF-8" ) ); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" ) ); Parser parser = ParserFactory.getWriterParser( reader, writer ); parser.parseXTVD(); writer.flush(); writer.close(); reader.close();
Reader
- - The stream from which the XML data is to
be read and parsed.Writer
- out - The stream to which the parsed XML
data is to be written.
net.sf.xtvdclient.gui.DataDirectException
- - If errors are encountered while
parsing the XML stream, or writing to the output stream.
DataDirectException
public static final Parser getXtvdParser(java.io.Reader in, Xtvd xtvd) throws DataDirectException
Parser
that will parse the XTVD XML
document
from the specified Reader
and create
a Xtvd
object that represents all the data contained in
the XML.
The following code sample shows a way of using this method:
BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( file ), "UTF-8" ) ); Xtvd xtvd = new Xtvd(); Parser parser = ParserFactory.getXtvdParser( reader, xtvd ); parser.parseXTVD(); reader.close();
Reader
- - The stream from which the XML data is to
be read and parsed.Xtvd
- xtvd - The instance of Xtvd that is to be populated
with the data from the XTVD document.
DataDirectException
- - If errors are encountered while
parsing the XML stream, or writing to the output stream.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |