public class FileSourceGraphML extends SourceBase implements FileSource, XMLStreamConstants
SourceBase.ElementType
Modifier and Type | Field and Description |
---|---|
protected LinkedList<FileSourceGraphML.Data> |
datas |
protected Stack<XMLEvent> |
events |
protected int |
graphCounter |
protected Stack<String> |
graphId |
protected HashMap<String,FileSourceGraphML.Key> |
keys |
protected XMLEventReader |
reader |
attrSinks, eltsSinks, eventProcessing, eventQueue, sourceId, sourceTime
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
Constructor and Description |
---|
FileSourceGraphML()
Build a new source to parse an xml stream in GraphML format.
|
Modifier and Type | Method and Description |
---|---|
private String |
__characters() |
private FileSourceGraphML.Data |
__data()
|
private 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(InputStream stream)
Begin reading the file stopping as soon as possible.
|
void |
begin(Reader reader)
Begin reading the file stopping as soon as possible.
|
void |
begin(String fileName)
Begin reading the file stopping as soon as possible.
|
void |
begin(URL url)
Begin reading the file stopping as soon as possible.
|
private void |
checkValid(XMLEvent e,
int type,
String name) |
protected void |
closeStream() |
void |
end()
Finish the reading process (even if
FileSource.nextEvents() or
FileSource.nextStep() did not returned false). |
private Object |
getDefaultValue(FileSourceGraphML.Key key) |
protected XMLEvent |
getNextEvent() |
private Object |
getValue(FileSourceGraphML.Data data) |
private String |
gotWhat(int type,
String v) |
private String |
gotWhat(XMLEvent e) |
private boolean |
isEvent(XMLEvent e,
int type,
String name) |
private XMLStreamException |
newParseError(XMLEvent e,
String msg,
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(Reader stream) |
protected void |
pushback(XMLEvent e) |
void |
readAll(InputStream stream)
Read the whole file in one big non-interruptible operation.
|
void |
readAll(Reader reader)
Read the whole file in one big non-interruptible operation.
|
void |
readAll(String fileName)
Read the whole file in one big non-interruptible operation.
|
void |
readAll(URL url)
Read the whole file in one big non-interruptible operation.
|
private void |
skipWhiteSpaces() |
protected String |
toConstantName(Attribute a) |
protected String |
toConstantName(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 XMLEventReader reader
protected HashMap<String,FileSourceGraphML.Key> keys
protected LinkedList<FileSourceGraphML.Data> datas
protected int graphCounter
public FileSourceGraphML()
public void readAll(String fileName) throws IOException
FileSource
readAll
in interface FileSource
fileName
- Name of the file to read.IOException
- If an I/O error occurs while reading.public void readAll(URL url) throws IOException
FileSource
readAll
in interface FileSource
url
- The URL of the file to read.IOException
- If an I/O error occurs while reading.public void readAll(InputStream stream) throws IOException
FileSource
readAll
in interface FileSource
stream
- The input stream to use for reading.IOException
- If an I/O error occurs while reading.public void readAll(Reader reader) throws IOException
FileSource
readAll
in interface FileSource
reader
- The reader to use.IOException
- If an I/O error occurs while reading.public void begin(String fileName) throws 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.IOException
- If an I/O error occurs while reading.public void begin(URL url) throws 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.IOException
- If an I/O error occurs while reading.public void begin(InputStream stream) throws 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.IOException
- If an I/O error occurs while reading.public void begin(Reader reader) throws 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.IOException
- If an I/O error occurs while reading.public boolean nextEvents() throws 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
IOException
- If an I/O error occurs while reading.public boolean nextStep() throws IOException
FileSource
nextStep
in interface FileSource
IOException
- If an I/O error occurs while reading.public void end() throws IOException
FileSource
FileSource.nextEvents()
or
FileSource.nextStep()
did not returned false). You must call this method
after reading.end
in interface FileSource
IOException
- If an I/O error occurs while closing the file.protected XMLEvent getNextEvent() throws IOException, XMLStreamException
IOException
XMLStreamException
private XMLStreamException newParseError(XMLEvent e, String msg, Object... args)
private void checkValid(XMLEvent e, int type, String name) throws XMLStreamException
XMLStreamException
private Object getValue(FileSourceGraphML.Data data)
private Object getDefaultValue(FileSourceGraphML.Key key)
private void skipWhiteSpaces() throws IOException, XMLStreamException
IOException
XMLStreamException
protected void openStream(Reader stream) throws IOException
IOException
protected void closeStream() throws IOException
IOException
protected String toConstantName(Attribute a)
protected String toConstantName(String value)
private void __graphml() throws IOException, XMLStreamException
IOException
XMLStreamException
private String __characters() throws IOException, XMLStreamException
IOException
XMLStreamException
private String __desc() throws IOException, XMLStreamException
IOException
XMLStreamException
private FileSourceGraphML.Locator __locator() throws IOException, XMLStreamException
IOException
XMLStreamException
private void __key() throws IOException, XMLStreamException
IOException
XMLStreamException
private FileSourceGraphML.Port __port() throws IOException, XMLStreamException
IOException
XMLStreamException
private FileSourceGraphML.EndPoint __endpoint() throws IOException, XMLStreamException
IOException
XMLStreamException
private FileSourceGraphML.Data __data() throws IOException, XMLStreamException
IOException
XMLStreamException
private void __graph() throws IOException, XMLStreamException
IOException
XMLStreamException
private void __node() throws IOException, XMLStreamException
IOException
XMLStreamException
private void __edge(boolean edgedefault) throws IOException, XMLStreamException
edgedefault
- IOException
XMLStreamException
private void __hyperedge() throws IOException, XMLStreamException
IOException
XMLStreamException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses