|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.util.XMLReader
public class XMLReader
XMLReader is a utility class used by XMLObjectInputStreamm to perform the actual XML parsing. This reader is based on the XML Pull-Parsing API, available online at http://www.xmlpull.org. Any of the provided parser implementations will work with this reader.
Field Summary | |
---|---|
protected int |
eventType
The cached type of the last event the parser saw |
protected java.io.Reader |
in
The actual reader which the parser uses |
protected org.xmlpull.v1.XmlPullParser |
xpp
The actual XML parser which we use |
Constructor Summary | |
---|---|
XMLReader(java.io.Reader in)
Constructor which takes the provided reader and builds a new XML parser to read XML from the reader. |
Method Summary | |
---|---|
void |
assertAttribute(java.lang.String name,
java.lang.String value)
Asserts that the given attribute exists and is equal to the given value. |
void |
assertEndTag()
Asserts that a end tag was just read |
void |
assertEndTag(java.lang.String name)
Asserts that the provided end tag was just read |
protected void |
assertEvent(int type)
Asserts that the given event type just happened. |
void |
assertStartTag()
Asserts that a start tag was just read |
void |
assertStartTag(java.lang.String name)
Asserts that the provided start tag was just read |
void |
close()
Method which closes the underlying reader, which will cause future step attempts to throw an IOException. |
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the given attribute, or null if the attribute cannot be found. |
java.lang.String |
getEndTag()
Returns the value of the current end tag |
java.lang.String |
getStartTag()
Returns the value of the current start tag |
boolean |
isEndDocument()
Returns whether or not a end document just happened |
boolean |
isEndTag()
Returns whether or not a end tag just happened |
boolean |
isStartDocument()
Returns whether or not a start document just happened |
boolean |
isStartTag()
Returns whether or not a start tag just happened |
boolean |
isText()
Returns whether or not a end tag just happened |
byte[] |
readBase64()
Method which writes a sequence of base64 encoded bytes to the output stream |
void |
readEndTag()
Asserts that a end tag will be read next. |
void |
readEndTag(java.lang.String name)
Asserts that the provided end tag will be read next. |
void |
readHeader()
Method which reads the header from the reader. |
void |
readStartTag()
Asserts that a start tag will be read next. |
void |
readStartTag(java.lang.String name)
Asserts that the provided start tag will be read next. |
void |
step()
Advances the parser one step, skipping whitespace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.Reader in
protected org.xmlpull.v1.XmlPullParser xpp
protected int eventType
Constructor Detail |
---|
public XMLReader(java.io.Reader in) throws java.io.IOException
in
- The reader to base this XML reader off of
java.io.IOException
- If an error occursMethod Detail |
---|
public void close() throws java.io.IOException
java.io.IOException
- If an error occurspublic byte[] readBase64() throws java.io.IOException
bytes
- The bytes to write
java.io.IOException
public void readHeader() throws java.io.IOException
java.io.IOException
- If an error occursprotected void assertEvent(int type) throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void assertStartTag() throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void assertEndTag() throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void assertStartTag(java.lang.String name) throws java.io.IOException
name
- The name of the start tag
java.io.IOException
- If a the assertion failedpublic void assertEndTag(java.lang.String name) throws java.io.IOException
name
- The name of the end tag
java.io.IOException
- If a the assertion failedpublic void readStartTag() throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void readEndTag() throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void readStartTag(java.lang.String name) throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void readEndTag(java.lang.String name) throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void assertAttribute(java.lang.String name, java.lang.String value) throws java.io.IOException
java.io.IOException
- If a the assertion failedpublic void step() throws java.io.IOException
java.io.IOException
- If an error occurspublic boolean isStartDocument()
public boolean isEndDocument()
public boolean isStartTag()
public boolean isEndTag()
public boolean isText()
public java.lang.String getAttribute(java.lang.String name) throws java.io.IOException
java.io.IOException
- If the current event is not a start tagpublic java.lang.String getStartTag() throws java.io.IOException
java.io.IOException
- If the current event is not a start tagpublic java.lang.String getEndTag() throws java.io.IOException
java.io.IOException
- If the current event is not a end tag
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |