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


Java FileUtils类代码示例

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


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

示例1: clearDb

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
public void clearDb() {
    long start = System.currentTimeMillis();
    maxNG = 0;
    try {
        if (wroteToDB) {
            FileUtils.deleteRecursively(new File(storeDir));
            wroteToDB = false;
        }
        if (tempStorageMatrix != null) {
            tempStorageMatrix.clearAll();
        }
        this.coveredRows.clear();
        NGLimit = Double.MAX_VALUE;
        timeSpentClearingDB.addAndGet(System.currentTimeMillis() - start);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:sapirgolan,项目名称:MFIBlocking,代码行数:19,代码来源:GDS_NG.java

示例2: clearDb

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
public void clearDb() {
	long start = System.currentTimeMillis();
	maxNG = 0;
	try {
		if(wroteToDB){
			FileUtils.deleteRecursively(new File(storeDir));
			wroteToDB = false;
		}
		if (tempStorageMatrix != null) {
			tempStorageMatrix.clearAll();
		}
		this.coveredRows.clear();			
		NGLimit = Double.MAX_VALUE;
		timeSpentClearingDB.addAndGet(System.currentTimeMillis() - start);
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:sapirgolan,项目名称:MFIBlocking,代码行数:19,代码来源:GDS_NG.java

示例3: fixPath

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private String fixPath( String dir, Map<?,?> config )
{
    File directories = new File( dir );
    if ( !directories.exists() )
    {
        if ( !directories.mkdirs() )
        {
            throw new UnderlyingStorageException(
                "Unable to create directory path["
                + storeDir + "] for Neo4j kernel store." );
        }
    }
    dir = FileUtils.fixSeparatorsInPath( dir );
    String fileSeparator = System.getProperty( "file.separator" );
    String store = dir + fileSeparator + NeoStore.DEFAULT_NAME;
    if ( !new File( store ).exists() )
    {
        NeoStore.createStore( store, config );
    }
    return store;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:22,代码来源:BatchInserterImpl.java

示例4: ClearDatabase

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
/**
 * Clears all data in the DB and reconnects to it afterwards.
 */
public void ClearDatabase(){
	// Shutdown database before erasing it
	log.debug("Shutting down the database");
	mGraphDb.shutdown();
	try
       {
		log.debug("Erasing the database files");
           FileUtils.deleteRecursively( new File( mDbPath ) );
       }
       catch ( IOException e )
       {
           throw new RuntimeException( e );
       }
	// Restart database
	log.debug("Reconnecting to database");
	mGraphDb = new GraphDatabaseFactory().
			newEmbeddedDatabaseBuilder(mDbPath).
			setConfig( GraphDatabaseSettings.node_keys_indexable, KEY_HASH ).
			setConfig( GraphDatabaseSettings.node_auto_indexing, "true" ).
			newGraphDatabase();
	registerShutdownHook(mGraphDb);
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:26,代码来源:Neo4JConnection.java

示例5: clearDb

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
public static void clearDb() {
	try {
		FileUtils.deleteRecursively(new File(dbURL));
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:8,代码来源:EntityEventNodeNeo4j.java

示例6: createEmbeddedDB

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private void createEmbeddedDB() {
    storeDir = RECORD_DB_DIR + "gds" + runningNum;
    try {
        FileUtils.deleteRecursively(new File(storeDir));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    runningNum++;
    GDS = new EmbeddedGraphDatabase(storeDir);
    registerShutdownHook(GDS);
}
 
开发者ID:sapirgolan,项目名称:MFIBlocking,代码行数:13,代码来源:GDS_NG.java

示例7: clearRecordDb

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private static void clearRecordDb() {
	try {
		FileUtils.deleteRecursively(new File(RECORD_DB_PATH));
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:sapirgolan,项目名称:MFIBlocking,代码行数:8,代码来源:Utilities.java

示例8: createEmbeddedDB

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private void createEmbeddedDB(){
	storeDir = RECORD_DB_DIR + "gds" + runningNum;		
	try {
		FileUtils.deleteRecursively(new File(storeDir));
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	runningNum++;
	GDS = new EmbeddedGraphDatabase(storeDir);
	registerShutdownHook(GDS);
}
 
开发者ID:sapirgolan,项目名称:MFIBlocking,代码行数:13,代码来源:GDS_NG.java

示例9: shutdown

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
public static void shutdown() {
    graphDB.shutdown();
    try {
        if(doShutdown) FileUtils.deleteRecursively(new File(dbPath));
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
开发者ID:ISA-tools,项目名称:Automacron,代码行数:10,代码来源:Neo4JConnector.java

示例10: renameLogFileToRightVersion

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private void renameLogFileToRightVersion( String logFileName, long endPosition ) throws IOException
{
    File file = new File( logFileName );
    if ( !file.exists() )
    {
        throw new IOException( "Logical log[" + logFileName +
            "] not found" );
    }

    FileChannel channel = new RandomAccessFile( logFileName, "rw" ).getChannel();
    long[] header = LogIoUtils.readLogHeader( ByteBuffer.allocate( 16 ), channel, false );
    try
    {
        FileUtils.truncateFile( channel, endPosition );
    }
    catch ( IOException e )
    {
        log.log( Level.WARNING,
            "Failed to truncate log at correct size", e );
    }
    channel.close();
    String newName;
    if ( header == null )
    {
        // header was never written
        newName = getFileName( -1 ) + "_empty_header_log_" + System.currentTimeMillis();
    }
    else
    {
        newName = getFileName( header[0] );
    }
    File newFile = new File( newName );
    boolean renamed = FileUtils.renameFile( file, newFile );
    if ( !renamed )
    {
        throw new IOException( "Failed to rename log to: " + newName );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:39,代码来源:XaLogicalLog.java

示例11: deleteLogFile

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private void deleteLogFile( String logFileName ) throws IOException
{
    File file = new File( logFileName );
    if ( !file.exists() )
    {
        throw new IOException( "Logical log[" + logFileName +
            "] not found" );
    }
    boolean deleted = FileUtils.deleteFile( file );
    if ( !deleted )
    {
        log.warning( "Unable to delete clean logical log[" + logFileName +
            "]" );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:16,代码来源:XaLogicalLog.java

示例12: migrateIdGenerators

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private void migrateIdGenerators( NeoStore neoStore ) throws IOException
{
    String[] idGeneratorSuffixes = new String[]{".nodestore.db.id", ".relationshipstore.db.id"};
    for ( String suffix : idGeneratorSuffixes )
    {
        FileUtils.copyFile( new File( legacyStore.getStorageFileName() + suffix ),
                new File( neoStore.getStorageFileName() + suffix ) );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:10,代码来源:StoreMigrator.java

示例13: moveFile

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
/**
 * Moves a file from one directory to another, by a rename op.
 *
 * @param fileName The base filename of the file to move, not the complete
 *            path
 * @param fromDirectory The directory currently containing filename
 * @param toDirectory The directory to host filename - must be in the same
 *            disk partition as filename
 * @throws IOException
 */
static void moveFile( String fileName, File fromDirectory,
        File toDirectory ) throws IOException
{
    if ( FileUtils.moveFile( new File( fromDirectory, fileName ),
            toDirectory ) == null )
    {
        throw new IOException( "Move of file " + fileName + " from "
                               + fromDirectory.getAbsolutePath()
                               + " to directory "
                               + toDirectory.getAbsolutePath() + " failed" );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:23,代码来源:StoreFiles.java

示例14: backupMessagesLogLeavingInPlaceForNewDatabaseMessages

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
private void backupMessagesLogLeavingInPlaceForNewDatabaseMessages( File workingDirectory, File backupDirectory )
{
    try
    {
        FileUtils.copyFile( new File( workingDirectory, "messages.log" ),
                new File( backupDirectory, "messages.log" ) );
    }
    catch ( IOException e )
    {
        throw new UnableToUpgradeException( e );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:13,代码来源:StoreUpgrader.java

示例15: deleteLogicalLog

import org.neo4j.kernel.impl.util.FileUtils; //导入依赖的package包/类
public boolean deleteLogicalLog( long version )
{
    File file = new File(getFileName( version ) );
    return file.exists() ? FileUtils.deleteFile( file ) : false;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:6,代码来源:XaLogicalLog.java


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