当前位置: 首页>>代码示例>>Java>>正文


Java GraphMLIOHandler类代码示例

本文整理汇总了Java中y.io.GraphMLIOHandler的典型用法代码示例。如果您正苦于以下问题:Java GraphMLIOHandler类的具体用法?Java GraphMLIOHandler怎么用?Java GraphMLIOHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GraphMLIOHandler类属于y.io包,在下文中一共展示了GraphMLIOHandler类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeIOHandler

import y.io.GraphMLIOHandler; //导入依赖的package包/类
/**
 * This method is called before the view modes and actions are registered
 * and the menu and toolbar is build.
 */
protected void initializeIOHandler() {
	// set up io handlers
	graphMLIOHandler = new GraphMLIOHandler();
	final GraphMLHandler handler = graphMLIOHandler.getGraphMLHandler();
	handler.addOutputHandlerProvider(new NodeOutputHandler());
	handler.addOutputHandlerProvider(new EdgeOutputHandler());
	handler.addInputHandlerProvider(new EdgeInputHandler());
	handler.addInputHandlerProvider(new NodeInputHandler());

	ygfIOHandler = new YGFIOHandler();
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:16,代码来源:GUIBase.java

示例2: getGraphXML

import y.io.GraphMLIOHandler; //导入依赖的package包/类
/**
 * return a xml string representation of the given graph
 * 
 * @param graph
 * @return graph XML string
 */
public static String getGraphXML(Graph2D graph) {
	StringBuilder xmlStringBuilder = new StringBuilder();
	String name = "temp.graphxml";
	File outputFile = new File(name);
	// write graph to a temp file
	GraphMLIOHandler ioh = new GraphMLIOHandler();
	final GraphMLHandler handler = ioh.getGraphMLHandler();
	handler.addInputHandlerProvider(new NodeInputHandler());
	handler.addInputHandlerProvider(new EdgeInputHandler());
	try {
		ioh.write(graph, name);

	} catch (IOException ioe) {
		D.show(ioe);
	}

	try {
		FileInputStream fstream = new FileInputStream(name);

		DataInputStream in = new DataInputStream(fstream);
		BufferedReader br = new BufferedReader(new InputStreamReader(in));
		String strLine;
		// Read File Line By Line
		while ((strLine = br.readLine()) != null) {
			xmlStringBuilder.append(strLine);
			xmlStringBuilder.append("\n");
		}
		in.close();
	} catch (Exception e) {
		System.err.println("Error: " + e.getMessage());
	}
	outputFile.delete();
	return xmlStringBuilder.toString();

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:42,代码来源:GUIBase.java


注:本文中的y.io.GraphMLIOHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。