@Test(expected = GraphIOException.class) public void testEmptyFile() throws Exception { String xml = ""; readGraph( xml, new DummyGraphObjectBase.UndirectedNetworkFactory(), new DummyNode.Factory(), new DummyEdge.EdgeFactory()); }
@SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G) graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse(xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); }
GraphMLReader2 implements GraphReader<G, N, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G) graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse(xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } }
GraphMLReader2 implements GraphReader<G, N, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G) graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse(xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } GraphMLReader2(
      Reader fileReader,
      Function<GraphMetadata, G> graphTransformer,
      Function<NodeMetadata, N> nodeTransformer,
      Function<EdgeMetadata, E> edgeTransformer);  GraphMLReader2(
      InputStream inputStream,
      Function<GraphMetadata, G> graphTransformer,
      Function<NodeMetadata, N> nodeTransformer,
      Function<EdgeMetadata, E> edgeTransformer); }
GraphMLReader2 implements GraphReader<G, N, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G) graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse(xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } GraphMLReader2(
      Reader fileReader,
      Function<GraphMetadata, G> graphTransformer,
      Function<NodeMetadata, N> nodeTransformer,
      Function<EdgeMetadata, E> edgeTransformer);  GraphMLReader2(
      InputStream inputStream,
      Function<GraphMetadata, G> graphTransformer,
      Function<NodeMetadata, N> nodeTransformer,
      Function<EdgeMetadata, E> edgeTransformer); Function<GraphMetadata, G> getGraphTransformer(); Function<NodeMetadata, N> getNodeTransformer(); Function<EdgeMetadata, E> getEdgeTransformer(); void init(); void close(); GraphMLDocument getGraphMLDocument(); @SuppressWarnings("unchecked") G readGraph(); }
GraphMLReader2 implements GraphReader<G, N, E> { @SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = (StartElement) event; String name = element.getName().getLocalPart(); if (GraphMLConstants.KEY_NAME.equals(name)) { Key key = (Key) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getKeyMap().addKey(key); } else if (GraphMLConstants.GRAPH_NAME.equals(name)) { GraphMetadata graph = (GraphMetadata) parserRegistry.getParser(name).parse(xmlEventReader, element); document.getGraphMetadata().add(graph); return (G) graph.getGraph(); } else if (GraphMLConstants.GRAPHML_NAME.equals(name)) { } else { parserRegistry.getUnknownElementParser().parse(xmlEventReader, element); } } else if (event.isEndDocument()) { break; } } } catch (Exception e) { ExceptionConverter.convert(e); } throw new GraphIOException("Unable to read Graph from document - the document could be empty"); } GraphMLReader2(
      Reader fileReader,
      Function<GraphMetadata, G> graphTransformer,
      Function<NodeMetadata, N> nodeTransformer,
      Function<EdgeMetadata, E> edgeTransformer);  GraphMLReader2(
      InputStream inputStream,
      Function<GraphMetadata, G> graphTransformer,
      Function<NodeMetadata, N> nodeTransformer,
      Function<EdgeMetadata, E> edgeTransformer); Function<GraphMetadata, G> getGraphTransformer(); Function<NodeMetadata, N> getNodeTransformer(); Function<EdgeMetadata, E> getEdgeTransformer(); void init(); void close(); GraphMLDocument getGraphMLDocument(); @SuppressWarnings("unchecked") G readGraph();  }