|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.architecture.traffic.xml.XMLLoader
public class XMLLoader
This class can restore the state of the program from an XML file. It also provides methods which XMLSerializable objects can use to retrieve their child objects.
| Field Summary | |
|---|---|
protected boolean |
atEOF
|
protected XMLElement |
nextElement
|
protected org.jscience.architecture.traffic.xml.XMLReader |
reader
|
protected XMLStack |
stack
|
| Constructor Summary | |
|---|---|
protected |
XMLLoader()
Simple constructor |
|
XMLLoader(java.io.File file)
Make a new XMLLoader which loads from a file |
|
XMLLoader(java.net.Socket socket)
Make a new XMLLoader which load from a socket |
| Method Summary | |
|---|---|
void |
close()
Close this XMLLoader |
void |
doStackDump()
This method is just for debugging |
java.util.Enumeration |
getEnumeration(XMLSerializable parent)
Ignores the further child objects of this XMLSerializable /** Returns an enumeration of XML elements which can be loaded. |
java.util.Enumeration |
getEnumeration(XMLSerializable parent,
java.lang.String tagName)
Returns an enumeration of XML elements with a specific name which can be loaded. |
XMLElement |
getNextElement(XMLSerializable parent)
Get the next element from the file |
XMLElement |
getNextElement(XMLSerializable parent,
java.lang.String name)
Get the next element from the file if it has a specific name |
java.lang.String |
getNextElementName()
|
boolean |
hasNextElement(XMLSerializable parent)
Checks if an XMLSerializable can get another element from the file |
boolean |
hasNextElement(XMLSerializable parent,
java.lang.String name)
Checks if an XMLSerializable can get an element with a specific name from the file. |
void |
load(XMLSerializable parent,
XMLSerializable object)
Load an XMLSerializable from the XML file |
void |
loadEnumeration(XMLSerializable parent,
java.util.Enumeration o)
Load an enumeration of XMLSerializables from the XML file |
protected void |
lookAhead()
Fill the nextElement buffer if it is empty |
protected XMLElement |
pullNextElement()
Tranfer the contents of the nextElement buffer to a XMLSerializable and fill the buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.jscience.architecture.traffic.xml.XMLReader reader
protected XMLElement nextElement
protected XMLStack stack
protected boolean atEOF
| Constructor Detail |
|---|
protected XMLLoader()
public XMLLoader(java.io.File file)
throws java.io.IOException,
XMLTreeException,
XMLInvalidInputException
file - The file to load from
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
initializing the XML tree structure.
XMLInvalidInputException - If the XML file contains invalid
values.
public XMLLoader(java.net.Socket socket)
throws java.io.IOException,
XMLTreeException,
XMLInvalidInputException
file - The file to load from
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
initializing the XML tree structure.
XMLInvalidInputException - If the XML file contains invalid
values.| Method Detail |
|---|
public void load(XMLSerializable parent,
XMLSerializable object)
throws XMLTreeException,
XMLInvalidInputException,
java.io.IOException
parent - The parent of this XMLSerializableobject - The XMLSerializable object itself
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
building the XML tree structure.
XMLInvalidInputException - If this XMLSerializable
encounters invalid input or cannot load itself for another
reason.public void close()
public void loadEnumeration(XMLSerializable parent,
java.util.Enumeration o)
throws XMLTreeException,
XMLInvalidInputException,
java.io.IOException,
java.lang.ClassCastException
parent - The parent of the XMLSerializableso - The enumeration of XML serializables
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
building the XML tree structure.
XMLInvalidInputException - If one of the XMLSerializables
encounters invalid input or cannot load itself for another
reason.
java.lang.ClassCastException - If the enumeration contains an object that
is not XMLSerializable
protected void lookAhead()
throws XMLTreeException,
java.io.IOException
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
building the XML tree structure.
public XMLElement getNextElement(XMLSerializable parent)
throws XMLTreeException,
java.io.IOException
parent - The XMLSerializable which is asking for the next element
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
building the XML tree structure or if the next element has
another parent.public boolean hasNextElement(XMLSerializable parent)
parent - The XMLSerializable that wants to request the next element
public XMLElement getNextElement(XMLSerializable parent,
java.lang.String name)
throws XMLTreeException,
java.io.IOException
parent - The XMLSerializable which is asking for the next elementname - The name which the next element has to have
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
building the XML tree structure or if the next element in the
file has another name/parent.
public boolean hasNextElement(XMLSerializable parent,
java.lang.String name)
parent - The XMLSerializable that wants to request the next elementname - The requested name
protected XMLElement pullNextElement()
throws java.io.IOException,
XMLTreeException
java.io.IOException - If the XMLLoader cannot read from the XML file because
of an IO error.
XMLTreeException - If something goes wrong while the parser is
building the XML tree structure.public java.lang.String getNextElementName()
public java.util.Enumeration getEnumeration(XMLSerializable parent)
parent - The object which is requesting the enumeration
public java.util.Enumeration getEnumeration(XMLSerializable parent,
java.lang.String tagName)
parent - The object which is requesting the enumerationname - The requested name
public void doStackDump()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||