|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrice.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 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(Reader in)
Constructor which takes the provided reader and builds a new XML parser to read XML from the reader. |
|
| Method Summary | |
|---|---|
void |
assertAttribute(String name,
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(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(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. |
String |
getAttribute(String name)
Returns the value of the given attribute, or null if the attribute cannot be found. |
String |
getEndTag()
Returns the value of the current end tag |
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(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(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 Reader in
protected org.xmlpull.v1.XmlPullParser xpp
protected int eventType
| Constructor Detail |
|---|
public XMLReader(Reader in)
throws IOException
in - The reader to base this XML reader off of
IOException - If an error occurs| Method Detail |
|---|
public void close()
throws IOException
IOException - If an error occurs
public byte[] readBase64()
throws IOException
bytes - The bytes to write
IOException
public void readHeader()
throws IOException
IOException - If an error occurs
protected void assertEvent(int type)
throws IOException
IOException - If a the assertion failed
public void assertStartTag()
throws IOException
IOException - If a the assertion failed
public void assertEndTag()
throws IOException
IOException - If a the assertion failed
public void assertStartTag(String name)
throws IOException
name - The name of the start tag
IOException - If a the assertion failed
public void assertEndTag(String name)
throws IOException
name - The name of the end tag
IOException - If a the assertion failed
public void readStartTag()
throws IOException
IOException - If a the assertion failed
public void readEndTag()
throws IOException
IOException - If a the assertion failed
public void readStartTag(String name)
throws IOException
IOException - If a the assertion failed
public void readEndTag(String name)
throws IOException
IOException - If a the assertion failed
public void assertAttribute(String name,
String value)
throws IOException
IOException - If a the assertion failed
public void step()
throws IOException
IOException - If an error occurspublic boolean isStartDocument()
public boolean isEndDocument()
public boolean isStartTag()
public boolean isEndTag()
public boolean isText()
public String getAttribute(String name)
throws IOException
IOException - If the current event is not a start tag
public String getStartTag()
throws IOException
IOException - If the current event is not a start tag
public String getEndTag()
throws IOException
IOException - If the current event is not a end tag
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||