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


Java FileUtils类代码示例

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


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

示例1: KnowledgeGraph

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public KnowledgeGraph(String db_path) {
	
	this.db_path = new String(db_path);

	// delete data from previous runs
	try {
		FileUtils.deleteRecursively(new File(this.db_path));
	} catch (IOException e) {
		e.printStackTrace();
	}

	// create a neo4j database
	this.graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(this.db_path);

	registerShutdownHook(graphDb);
}
 
开发者ID:sunil3590,项目名称:artificial-guy,代码行数:18,代码来源:KnowledgeGraph.java

示例2: setUp

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
/**
	 * Setup the database and construct the graph.
	 */
	@BeforeClass
	public static void setUp() {
		try {
			FileUtils.deleteRecursively(new File(DB_PATH));
			nodeFile = Neo4jGraphTest.class.getResourceAsStream("/strains/cluster.node.graph");
			edgeFile = Neo4jGraphTest.class.getResourceAsStream("/strains/cluster.edge.graph");
//			nodeFile = new File("10_strains_graph/simple_graph.node.graph");
//			edgeFile = new File("10_strains_graph/simple_graph.edge.graph");
			Iterator<SequenceNode> np = new NodeIterator(new SequenceNodeFactoryImpl(),
					new BufferedReader(new InputStreamReader(nodeFile, "UTF-8")));
			Iterator<Edge<?>> ep = new EdgeIterator(new BufferedReader(
							new InputStreamReader(edgeFile, "UTF-8")));
			db = (Neo4jGraph) new Neo4jBatchBuilder(DB_PATH, new AnnotationCollectionImpl())
				.constructGraph(np, ep)
				.build();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:23,代码来源:Neo4jClusterTest.java

示例3: setupServices

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
/**
 * Setup the {@link GraphLoadService}.
 */
private void setupServices() {
	graphLoadService = new GraphLoadService();
	graphLoadService.progressProperty().addListener((e, oldV, newV) -> {
		progressDialog.setProgress(newV.doubleValue());
	});
	graphLoadService.setOnCancelled(e -> {
		progressDialog.close();
		try {
			FileUtils.deleteRecursively(new File(graphLoadService.getDatabase()));
		} catch (Exception exc) {
			new ExceptionDialog(container.getParent(), exc, "Failed to delete database.");
		}
	});
	graphLoadService.setOnFailed(e -> {
		progressDialog.close();
		new ExceptionDialog(container.getParent(), graphLoadService.getException(),
				"Error loading graph files!");
	});
	graphLoadService.setOnRunning(e -> progressDialog.show());
	graphLoadService.setOnSucceeded(e -> {
		progressDialog.close();
		graphProperty.setValue(graphLoadService.getValue());
	});
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:28,代码来源:OpenPaneController.java

示例4: snapshot

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
private File snapshot( final String path ) throws IOException
{
    File snapshotDir = new File( path, "snapshot-" + new Random().nextInt() );
    FileUtils.copyRecursively( new File( path ), snapshotDir, new FileFilter()
    {
        @Override
        public boolean accept( File pathName )
        {
            String subPath = pathName.getAbsolutePath().substring( path.length() ).replace( File.separatorChar, '/' );
            if ( "/store_lock".equals( subPath ) )
            {
                return false; // since the db is running, exclude the 'store_lock' file
            }
            if ( subPath.startsWith( "/schema/index/lucene/" ) || subPath.startsWith( "/schema/label/lucene/" ) )
            {
                return !subPath.endsWith( "/write.lock" ); // since the db is running, exclude lucene lock files
            }
            return true;
        }
    } );
    return snapshotDir;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:23,代码来源:UniqueIndexRecoveryTests.java

示例5: NeoDb

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
public NeoDb(String dbPath, long flushInterval, int cacheCapacity) throws IOException {
	this.flushInterval = flushInterval;
	this.cacheCapacity = cacheCapacity;
	File tempStoreDir = new File(dbPath);
	FileUtils.deleteRecursively(tempStoreDir);
	this.inserter = BatchInserters.inserter(tempStoreDir);
	this.indexProvider = new LuceneBatchInserterIndexProvider(this.inserter);
}
 
开发者ID:bigbai0210,项目名称:Oracle2Neo4j,代码行数:9,代码来源:NeoDb.java

示例6: setUp

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
/**
 * Setup the database and construct the graph.
 * @throws URISyntaxException when the path is incorrect
 */
@BeforeClass
public static void setUp() throws URISyntaxException {
	try {
		FileUtils.deleteRecursively(new File(DB_PATH));
		nodeFile = getNodeFile();
		edgeFile = getEdgeFile();
		Iterator<SequenceNode> np = new NodeIterator(new SequenceNodeFactoryImpl(),
				new BufferedReader(new InputStreamReader(nodeFile, "UTF-8")));
		Iterator<Edge<?>> ep = new EdgeIterator(new BufferedReader(
						new InputStreamReader(edgeFile, "UTF-8")));
		TreeNode phylo = new TreeParser(getTreeFile()).parse();
		db = (Neo4jGraph) new Neo4jBatchBuilder(DB_PATH, new AnnotationCollectionImpl(), phylo)
			.constructGraph(np, ep)
			.build();
	} catch (IOException e) {
		fail("Couldn't initialize DB");
	}
	//CHECKSTYLE.OFF: MagicNumber
	first = new AnnotationImpl("first", 0, 10, true);
	middle = new AnnotationImpl("middle", 5, 25, true);
	last = new AnnotationImpl("last", 20, 30, true);
	//CHECKSTYLE.ON: MagicNumber
	db.addAnnotation(first);
	db.addAnnotation(middle);
	db.addAnnotation(last);
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:31,代码来源:Neo4jGraphTest.java

示例7: deleteButtonAction

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
@SuppressWarnings("unused") @FXML 
private void deleteButtonAction(ActionEvent a) {
	try {
		FileUtils.deleteRecursively(new File(dbload.getDatabase()));
		databases.remove(dbload.getDatabase());
	} catch (Exception e) {
		new ExceptionDialog(dblist.getParent(), e, "Failed to delete database.");
	}
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:10,代码来源:WelcomeController.java

示例8: setUp

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
/**
 * Delete old database.
 */
@BeforeClass
public static void setUp() {
	try {
		FileUtils.deleteRecursively(new File(DB_PATH));
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:12,代码来源:DBLoadServiceTest.java

示例9: setUp

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
/**
 * Setup the database and construct the graph.
 */
@BeforeClass
public static void setUp() {
	try {
		FileUtils.deleteRecursively(new File(DB_PATH));
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:12,代码来源:GraphLoadServiceTest.java

示例10: unpackDbFrom

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
private GraphDatabaseService unpackDbFrom( String file ) throws IOException
{
    File path = new File( "target/var/zipup" );
    FileUtils.deleteRecursively( path );
    path.mkdirs();
    ZipInputStream zip = new ZipInputStream( getClass().getClassLoader().getResourceAsStream( file ) );
    ZipEntry entry = null;
    byte[] buffer = new byte[2048];
    while ( (entry = zip.getNextEntry()) != null )
    {
        if ( entry.isDirectory() )
        {
            new File( path, entry.getName() ).mkdirs();
            continue;
        }
        FileOutputStream fos = new FileOutputStream( new File( path, entry.getName() ) );
        BufferedOutputStream bos = new BufferedOutputStream( fos, buffer.length );

        int size;
        while ( (size = zip.read( buffer, 0, buffer.length )) != -1 )
        {
            bos.write( buffer, 0, size );
        }
        bos.flush();
        bos.close();
    }
    return startDatabase( path );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:29,代码来源:TestMigration.java

示例11: main

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    FileUtils.deleteRecursively(new File(STORE_DIR));
    long time = System.currentTimeMillis();
    Rules rules = new Rules(); // asList("titles")
    new DatabaseImporter("jdbc:mysql://localhost:3306/northwind?user=root", "northwind", STORE_DIR, rules).run();
    long delta = (System.currentTimeMillis() - time) / 1000;
    String result = importInfo();
    System.out.println(result + " in " + delta + " seconds");
}
 
开发者ID:jexp,项目名称:neo4j-rdbms-import,代码行数:10,代码来源:DataImporterNorthwindTest.java

示例12: main

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    FileUtils.deleteRecursively(new File(STORE_DIR));
    long time = System.currentTimeMillis();
    new DatabaseImporter("jdbc:mysql://localhost:3306/sakila?user=root", "sakila", STORE_DIR, new Rules()).run();

    long delta = (System.currentTimeMillis() - time) / 1000;
    String result = importInfo();
    System.out.println(result + " in " + delta + " seconds");
}
 
开发者ID:jexp,项目名称:neo4j-rdbms-import,代码行数:10,代码来源:DataImporterSakilaTest.java

示例13: main

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    FileUtils.deleteRecursively(new File(STORE_DIR));
    StopWatch watch = new StopWatch();
    Rules rules = new Rules(); // asList("titles")
    new DatabaseImporter("jdbc:mysql://localhost:3306/employees?user=root", "employees", STORE_DIR, rules).run();

    watch.lap("import");
    System.err.println(watch.stop("import", importInfo()));
}
 
开发者ID:jexp,项目名称:neo4j-rdbms-import,代码行数:10,代码来源:DataImporterEmployeeTest.java

示例14: main

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    setupDatabase();

    FileUtils.deleteRecursively(new File(STORE_DIR));
    long time = System.currentTimeMillis();
    new DatabaseImporter("jdbc:derby:memory:test", null, STORE_DIR, new Rules()).run();

    String result = assertImport();
    System.out.println(result + " in " + (System.currentTimeMillis() - time) / 1000 + " seconds");
}
 
开发者ID:jexp,项目名称:neo4j-rdbms-import,代码行数:11,代码来源:DataImporterTest.java

示例15: breakDown

import org.neo4j.io.fs.FileUtils; //导入依赖的package包/类
@After
public void breakDown() throws IOException{
  FileUtils.deleteRecursively(new File(neo4jLocation));
}
 
开发者ID:tmills,项目名称:umls-graph-api,代码行数:5,代码来源:TestRelReader.java


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