public class FileSourceGraphML extends SourceBase implements FileSource, javax.xml.stream.XMLStreamConstants
SourceBase.ElementType
Modifier and Type | Field and Description |
---|---|
protected java.util.LinkedList<FileSourceGraphML.Data> |
datas |
protected java.util.Stack<javax.xml.stream.events.XMLEvent> |
events |
protected int |
graphCounter |
protected java.util.Stack<java.lang.String> |
graphId |
protected java.util.HashMap<java.lang.String,FileSourceGraphML.Key> |
keys |
protected javax.xml.stream.XMLEventReader |
reader |
attrSinks, eltsSinks, eventProcessing, eventQueue, sourceId, sourceTime
Constructor and Description |
---|
FileSourceGraphML()
Build a new source to parse an xml stream in GraphML format.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
__characters() |
private FileSourceGraphML.Data |
__data()
|
private java.lang.String |
__desc()
|
private void |
__edge(boolean edgedefault)
|
private FileSourceGraphML.EndPoint |
__endpoint()
|
private void |
__graph()
|
private void |
__graphml()
|
private void |
__hyperedge()
|
private void |
__key()
|
private FileSourceGraphML.Locator |
__locator()
|
private void |
__node()
|
private FileSourceGraphML.Port |
__port()
|
void |
begin(java.io.InputStream stream)
Begin reading the file stopping as soon as possible.
|
void |
begin(java.io.Reader reader)
Begin reading the file stopping as soon as possible.
|
void |
begin(java.lang.String fileName)
Begin reading the file stopping as soon as possible.
|
void |
begin(java.net.URL url)
Begin reading the file stopping as soon as possible.
|
private void |
checkValid(javax.xml.stream.events.XMLEvent e,
int type,
java.lang.String name) |
protected void |
closeStream() |
void |
end()
Finish the reading process (even if
FileSource.nextEvents() or
FileSource.nextStep() did not returned false). |
private java.lang.Object |
getDefaultValue(FileSourceGraphML.Key key) |
protected javax.xml.stream.events.XMLEvent |
getNextEvent() |
private java.lang.Object |
getValue(FileSourceGraphML.Data data) |
private java.lang.String |
gotWhat(int type,
java.lang.String v) |
private java.lang.String |
gotWhat(javax.xml.stream.events.XMLEvent e) |
private boolean |
isEvent(javax.xml.stream.events.XMLEvent e,
int type,
java.lang.String name) |
private javax.xml.stream.XMLStreamException |
newParseError(javax.xml.stream.events.XMLEvent e,
java.lang.String msg,
java.lang.Object... args) |
boolean |
nextEvents()
Try to process one graph event, or as few as possible, if more must be
read at once.
|
boolean |
nextStep()
Try to process all the events occurring during one time step.
|
protected void |
openStream(java.io.Reader stream) |
protected void |
pushback(javax.xml.stream.events.XMLEvent e) |
void |
readAll(java.io.InputStream stream)
Read the whole file in one big non-interruptible operation.
|
void |
readAll(java.io.Reader reader)
Read the whole file in one big non-interruptible operation.
|
void |
readAll(java.lang.String fileName)
Read the whole file in one big non-interruptible operation.
|
void |
readAll(java.net.URL url)
Read the whole file in one big non-interruptible operation.
|
private void |
skipWhiteSpaces() |
protected java.lang.String |
toConstantName(javax.xml.stream.events.Attribute a) |
protected java.lang.String |
toConstantName(java.lang.String value) |
addAttributeSink, addElementSink, addSink, attributeSinks, clearAttributeSinks, clearElementSinks, clearSinks, elementSinks, manageEvents, removeAttributeSink, removeElementSink, removeSink, sendAttributeChangedEvent, sendAttributeChangedEvent, sendEdgeAdded, sendEdgeAdded, sendEdgeAttributeAdded, sendEdgeAttributeAdded, sendEdgeAttributeChanged, sendEdgeAttributeChanged, sendEdgeAttributeRemoved, sendEdgeAttributeRemoved, sendEdgeRemoved, sendEdgeRemoved, sendGraphAttributeAdded, sendGraphAttributeAdded, sendGraphAttributeChanged, sendGraphAttributeChanged, sendGraphAttributeRemoved, sendGraphAttributeRemoved, sendGraphCleared, sendGraphCleared, sendNodeAdded, sendNodeAdded, sendNodeAttributeAdded, sendNodeAttributeAdded, sendNodeAttributeChanged, sendNodeAttributeChanged, sendNodeAttributeRemoved, sendNodeAttributeRemoved, sendNodeRemoved, sendNodeRemoved, sendStepBegins, sendStepBegins
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttributeSink, addElementSink, addSink, clearAttributeSinks, clearElementSinks, clearSinks, removeAttributeSink, removeElementSink, removeSink
protected javax.xml.stream.XMLEventReader reader
protected java.util.HashMap<java.lang.String,FileSourceGraphML.Key> keys
protected java.util.LinkedList<FileSourceGraphML.Data> datas
protected java.util.Stack<javax.xml.stream.events.XMLEvent> events
protected java.util.Stack<java.lang.String> graphId
protected int graphCounter
public FileSourceGraphML()
public void readAll(java.lang.String fileName) throws java.io.IOException
FileSource
readAll
in interface FileSource
fileName
- Name of the file to read.java.io.IOException
- If an I/O error occurs while reading.public void readAll(java.net.URL url) throws java.io.IOException
FileSource
readAll
in interface FileSource
url
- The URL of the file to read.java.io.IOException
- If an I/O error occurs while reading.public void readAll(java.io.InputStream stream) throws java.io.IOException
FileSource
readAll
in interface FileSource
stream
- The input stream to use for reading.java.io.IOException
- If an I/O error occurs while reading.public void readAll(java.io.Reader reader) throws java.io.IOException
FileSource
readAll
in interface FileSource
reader
- The reader to use.java.io.IOException
- If an I/O error occurs while reading.public void begin(java.lang.String fileName) throws java.io.IOException
FileSource
FileSource.nextEvents()
or
FileSource.nextStep()
. Once begin() has been called, you must finish the
reading process using FileSource.end()
. You cannot call begin() twice
without having called FileSource.end()
in between.begin
in interface FileSource
fileName
- Name of the file to read.java.io.IOException
- If an I/O error occurs while reading.public void begin(java.net.URL url) throws java.io.IOException
FileSource
FileSource.nextEvents()
or
FileSource.nextStep()
. Once begin() has been called, you must finish the
reading process using FileSource.end()
. You cannot call begin() twice
without having called FileSource.end()
in between.begin
in interface FileSource
url
- The URL of the file to read.java.io.IOException
- If an I/O error occurs while reading.public void begin(java.io.InputStream stream) throws java.io.IOException
FileSource
FileSource.nextEvents()
or
FileSource.nextStep()
. Once begin() has been called, you must finish the
reading process using FileSource.end()
. You cannot call begin() twice
without having called FileSource.end()
in between.begin
in interface FileSource
stream
- The input stream to use for reading.java.io.IOException
- If an I/O error occurs while reading.public void begin(java.io.Reader reader) throws java.io.IOException
FileSource
FileSource.nextEvents()
or
FileSource.nextStep()
. Once begin() has been called, you must finish the
reading process using FileSource.end()
. You cannot call begin() twice
without having called FileSource.end()
in between.begin
in interface FileSource
reader
- The file reader to use.java.io.IOException
- If an I/O error occurs while reading.public boolean nextEvents() throws java.io.IOException
FileSource
FileSource.begin(InputStream)
or FileSource.begin(String)
before. This method
return true while there are still events to read.nextEvents
in interface FileSource
java.io.IOException
- If an I/O error occurs while reading.public boolean nextStep() throws java.io.IOException
FileSource
nextStep
in interface FileSource
java.io.IOException
- If an I/O error occurs while reading.public void end() throws java.io.IOException
FileSource
FileSource.nextEvents()
or
FileSource.nextStep()
did not returned false). You must call this method
after reading.end
in interface FileSource
java.io.IOException
- If an I/O error occurs while closing the file.protected javax.xml.stream.events.XMLEvent getNextEvent() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected void pushback(javax.xml.stream.events.XMLEvent e)
private javax.xml.stream.XMLStreamException newParseError(javax.xml.stream.events.XMLEvent e, java.lang.String msg, java.lang.Object... args)
private boolean isEvent(javax.xml.stream.events.XMLEvent e, int type, java.lang.String name)
private void checkValid(javax.xml.stream.events.XMLEvent e, int type, java.lang.String name) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private java.lang.String gotWhat(javax.xml.stream.events.XMLEvent e)
private java.lang.String gotWhat(int type, java.lang.String v)
private java.lang.Object getValue(FileSourceGraphML.Data data)
private java.lang.Object getDefaultValue(FileSourceGraphML.Key key)
private void skipWhiteSpaces() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected void openStream(java.io.Reader stream) throws java.io.IOException
java.io.IOException
protected void closeStream() throws java.io.IOException
java.io.IOException
protected java.lang.String toConstantName(javax.xml.stream.events.Attribute a)
protected java.lang.String toConstantName(java.lang.String value)
private void __graphml() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private java.lang.String __characters() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private java.lang.String __desc() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private FileSourceGraphML.Locator __locator() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private void __key() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private FileSourceGraphML.Port __port() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private FileSourceGraphML.EndPoint __endpoint() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private FileSourceGraphML.Data __data() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private void __graph() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private void __node() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
private void __edge(boolean edgedefault) throws java.io.IOException, javax.xml.stream.XMLStreamException
edgedefault
- java.io.IOException
javax.xml.stream.XMLStreamException
private void __hyperedge() throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException