Package com.google.api.client.xml.atom
Class AbstractAtomFeedParser<T>
- java.lang.Object
-
- com.google.api.client.xml.atom.AbstractAtomFeedParser<T>
-
- Type Parameters:
T- feed type
- Direct Known Subclasses:
AtomFeedParser
@Beta public abstract class AbstractAtomFeedParser<T> extends java.lang.Object
Beta
Abstract base class for an Atom feed parser when the feed type is known in advance.Implementation is not thread-safe.
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<T>feedClassFeed class to parse.private booleanfeedParsedWhether the feed has been parsed.private java.io.InputStreaminputStreamInput stream to read.private XmlNamespaceDictionarynamespaceDictionaryXML namespace dictionary.private org.xmlpull.v1.XmlPullParserparserXML pull parser to use.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAtomFeedParser(XmlNamespaceDictionary namespaceDictionary, org.xmlpull.v1.XmlPullParser parser, java.io.InputStream inputStream, java.lang.Class<T> feedClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying parser.java.lang.Class<T>getFeedClass()Returns the feed class to parse.java.io.InputStreamgetInputStream()Returns the input stream to read.XmlNamespaceDictionarygetNamespaceDictionary()Returns the XML namespace dictionary.org.xmlpull.v1.XmlPullParsergetParser()Returns the XML pull parser to use.protected abstract java.lang.ObjectparseEntryInternal()Parses a single entry.TparseFeed()Parse the feed and return a new parsed instance of the feed type.java.lang.ObjectparseNextEntry()Parse the next item in the feed and return a new parsed instance of the item type.
-
-
-
Field Detail
-
feedParsed
private boolean feedParsed
Whether the feed has been parsed.
-
parser
private final org.xmlpull.v1.XmlPullParser parser
XML pull parser to use.
-
inputStream
private final java.io.InputStream inputStream
Input stream to read.
-
feedClass
private final java.lang.Class<T> feedClass
Feed class to parse.
-
namespaceDictionary
private final XmlNamespaceDictionary namespaceDictionary
XML namespace dictionary.
-
-
Constructor Detail
-
AbstractAtomFeedParser
protected AbstractAtomFeedParser(XmlNamespaceDictionary namespaceDictionary, org.xmlpull.v1.XmlPullParser parser, java.io.InputStream inputStream, java.lang.Class<T> feedClass)
- Parameters:
namespaceDictionary- XML namespace dictionaryparser- XML pull parser to useinputStream- input stream to readfeedClass- feed class to parse- Since:
- 1.5
-
-
Method Detail
-
getParser
public final org.xmlpull.v1.XmlPullParser getParser()
Returns the XML pull parser to use.- Since:
- 1.5
-
getInputStream
public final java.io.InputStream getInputStream()
Returns the input stream to read.- Since:
- 1.5
-
getFeedClass
public final java.lang.Class<T> getFeedClass()
Returns the feed class to parse.- Since:
- 1.5
-
getNamespaceDictionary
public final XmlNamespaceDictionary getNamespaceDictionary()
Returns the XML namespace dictionary.- Since:
- 1.5
-
parseFeed
public T parseFeed() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
Parse the feed and return a new parsed instance of the feed type. This method can be skipped if all you want are the items.- Throws:
java.io.IOException- I/O exceptionorg.xmlpull.v1.XmlPullParserException- XML pull parser exception
-
parseNextEntry
public java.lang.Object parseNextEntry() throws java.io.IOException, org.xmlpull.v1.XmlPullParserExceptionParse the next item in the feed and return a new parsed instance of the item type. If there is no item to parse, it will returnnulland automatically close the parser (in which case there is no need to callclose().- Throws:
java.io.IOException- I/O exceptionorg.xmlpull.v1.XmlPullParserException- XML pull parser exception
-
close
public void close() throws java.io.IOExceptionCloses the underlying parser.- Throws:
java.io.IOException
-
parseEntryInternal
protected abstract java.lang.Object parseEntryInternal() throws java.io.IOException, org.xmlpull.v1.XmlPullParserExceptionParses a single entry.- Returns:
- object representing the entry
- Throws:
java.io.IOException- I/O exceptionorg.xmlpull.v1.XmlPullParserException- XML pull parser exception
-
-