本文整理了Java中org.neo4j.io.fs.FileUtils.copyFile()
方法的一些代码示例,展示了FileUtils.copyFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.copyFile()
方法的具体详情如下:
包路径:org.neo4j.io.fs.FileUtils
类名称:FileUtils
方法名:copyFile
[英]Utility method that copy a file from its current location to the provided target directory.
[中]将文件从当前位置复制到提供的目标目录的实用方法。
代码示例来源:origin: neo4j/neo4j
@Override
public void copyFile( File from, File to ) throws IOException
{
FileUtils.copyFile( from, to );
}
代码示例来源:origin: neo4j/neo4j
/**
* Utility method that copy a file from its current location to the
* provided target directory.
*
* @param file file that needs to be copied.
* @param targetDirectory the destination directory
* @throws IOException
*/
public static void copyFileToDirectory( File file, File targetDirectory ) throws IOException
{
if ( !targetDirectory.exists() )
{
Files.createDirectories( targetDirectory.toPath() );
}
if ( !targetDirectory.isDirectory() )
{
throw new IllegalArgumentException(
"Move target must be a directory, not " + targetDirectory );
}
File target = new File( targetDirectory, file.getName() );
copyFile( file, target );
}
代码示例来源:origin: neo4j/neo4j
public static void copyRecursively( File fromDirectory, File toDirectory, FileFilter filter ) throws IOException
{
File[] files = fromDirectory.listFiles( filter );
if ( files != null )
{
for ( File fromFile : files )
{
File toFile = new File( toDirectory, fromFile.getName() );
if ( fromFile.isDirectory() )
{
Files.createDirectories( toFile.toPath() );
copyRecursively( fromFile, toFile, filter );
}
else
{
copyFile( fromFile, toFile );
}
}
}
}
代码示例来源:origin: neo4j/neo4j
copyFile( toMove, target );
deleteFile( toMove );
代码示例来源:origin: neo4j/neo4j
@Before
public void setup() throws Exception
{
home = testDirectory.directory( "home" );
File baseDir = new File( home, "certificates/default" );
publicCertificateFile = new File( baseDir, "public.crt" );
privateKeyFile = new File( baseDir, "private.key" );
new PkiUtils().createSelfSignedCertificate(
publicCertificateFile, privateKeyFile, "localhost" );
File trustedDir = new File( baseDir, "trusted" );
trustedDir.mkdir();
FileUtils.copyFile( publicCertificateFile, new File( trustedDir, "public.crt" ) );
new File( baseDir, "revoked" ).mkdir();
}
代码示例来源:origin: neo4j/neo4j
@Test
public void reportNotCleanLabelIndexWithCorrectData() throws IOException, ConsistencyCheckIncompleteException
{
DatabaseLayout databaseLayout = db.databaseLayout();
someData();
db.resolveDependency( CheckPointer.class ).forceCheckPoint( new SimpleTriggerInfo( "forcedCheckpoint" ) );
File labelIndexFileCopy = databaseLayout.file( "label_index_copy" );
copyFile( databaseLayout.labelScanStore(), labelIndexFileCopy );
db.shutdownAndKeepStore();
copyFile( labelIndexFileCopy, databaseLayout.labelScanStore() );
ConsistencyCheckService.Result result = fullConsistencyCheck();
assertTrue( "Expected consistency check to fail", result.isSuccessful() );
assertThat( readReport( result ),
hasItem( containsString("WARN : Label index was not properly shutdown and rebuild is required.") ) );
}
代码示例来源:origin: neo4j/neo4j
@Test
public void reportNotCleanLabelIndex() throws IOException, ConsistencyCheckIncompleteException
{
DatabaseLayout databaseLayout = db.databaseLayout();
someData();
db.resolveDependency( CheckPointer.class ).forceCheckPoint( new SimpleTriggerInfo( "forcedCheckpoint" ) );
File labelIndexFileCopy = databaseLayout.file( "label_index_copy" );
copyFile( databaseLayout.labelScanStore(), labelIndexFileCopy );
try ( Transaction tx = db.beginTx() )
{
db.createNode( LABEL_ONE );
tx.success();
}
db.shutdownAndKeepStore();
copyFile( labelIndexFileCopy, databaseLayout.labelScanStore() );
ConsistencyCheckService.Result result = fullConsistencyCheck();
assertFalse( "Expected consistency check to fail", result.isSuccessful() );
assertThat( readReport( result ),
hasItem( containsString("WARN : Label index was not properly shutdown and rebuild is required.") ) );
}
代码示例来源:origin: org.neo4j/neo4j-io
@Override
public void copyFile( File from, File to ) throws IOException
{
FileUtils.copyFile( from, to );
}
代码示例来源:origin: jexp/store-utils
private static void copyIndex(File source, File target) throws IOException {
final File indexFile = new File(source, "index.db");
if (indexFile.exists()) {
FileUtils.copyFile(indexFile, new File(target, "index.db"));
}
final File indexDir = new File(source, "index");
if (indexDir.exists()) {
FileUtils.copyRecursively(indexDir, new File(target, "index"));
}
}
代码示例来源:origin: jexp/store-utils
private static void copyIndex(File source, File target) throws IOException {
final File indexFile = new File(source, "index.db");
if (indexFile.exists()) {
FileUtils.copyFile(indexFile, new File(target, "index.db"));
}
final File indexDir = new File(source, "index");
if (indexDir.exists()) {
FileUtils.copyRecursively(indexDir, new File(target, "index"));
}
}
代码示例来源:origin: org.neo4j/neo4j-io
/**
* Utility method that copy a file from its current location to the
* provided target directory.
*
* @param file file that needs to be copied.
* @param targetDirectory the destination directory
* @throws IOException
*/
public static void copyFileToDirectory( File file, File targetDirectory ) throws IOException
{
if ( !targetDirectory.exists() )
{
Files.createDirectories( targetDirectory.toPath() );
}
if ( !targetDirectory.isDirectory() )
{
throw new IllegalArgumentException(
"Move target must be a directory, not " + targetDirectory );
}
File target = new File( targetDirectory, file.getName() );
copyFile( file, target );
}
代码示例来源:origin: org.neo4j/neo4j-io
public static void copyRecursively( File fromDirectory, File toDirectory, FileFilter filter ) throws IOException
{
File[] files = fromDirectory.listFiles( filter );
if ( files != null )
{
for ( File fromFile : files )
{
File toFile = new File( toDirectory, fromFile.getName() );
if ( fromFile.isDirectory() )
{
Files.createDirectories( toFile.toPath() );
copyRecursively( fromFile, toFile, filter );
}
else
{
copyFile( fromFile, toFile );
}
}
}
}
代码示例来源:origin: org.neo4j/neo4j-io
copyFile( toMove, target );
deleteFile( toMove );
内容来源于网络,如有侵权,请联系作者删除!