gpt4 book ai didi

org.neo4j.io.compress.ZipUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:04:09 26 4
gpt4 key购买 nike

本文整理了Java中org.neo4j.io.compress.ZipUtils类的一些代码示例,展示了ZipUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtils类的具体详情如下:
包路径:org.neo4j.io.compress.ZipUtils
类名称:ZipUtils

ZipUtils介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

/**
   * Deletes index folder with the specific indexId, but has the option to first archive the index if it exists.
   * The zip archive will be placed next to the root directory for that index with a timestamp included in its name.
   *
   * @param fs {@link FileSystemAbstraction} this index lives in.
   * @param directoryStructure {@link IndexDirectoryStructure} knowing the directory structure for the provider owning the index.
   * @param indexId id of the index.
   * @param archiveIfExists whether or not to archive the index before deleting it, if it exists.
   * @return whether or not an archive was created.
   * @throws IOException on I/O error.
   */
  public static boolean deleteIndex( FileSystemAbstraction fs, IndexDirectoryStructure directoryStructure, long indexId, boolean archiveIfExists )
      throws IOException
  {
    File rootIndexDirectory = directoryStructure.directoryForIndex( indexId );
    if ( archiveIfExists && fs.isDirectory( rootIndexDirectory ) && fs.fileExists( rootIndexDirectory ) && fs.listFiles( rootIndexDirectory ).length > 0 )
    {
      ZipUtils.zip( fs, rootIndexDirectory,
          new File( rootIndexDirectory.getParent(), "archive-" + rootIndexDirectory.getName() + "-" + System.currentTimeMillis() + ".zip" ) );
      return true;
    }
    fs.deleteRecursively( rootIndexDirectory );
    return false;
  }
}

代码示例来源:origin: neo4j/neo4j

if ( isEmptyDirectory( fileSystem, sourceToCompress ) )

代码示例来源:origin: neo4j/neo4j

@Test
void doNotCreateZipArchiveForNonExistentSource() throws IOException
{
  File archiveFile = testDirectory.file( "archive.zip" );
  ZipUtils.zip( fileSystem, testDirectory.file( "doesNotExist" ), archiveFile );
  assertFalse( fileSystem.fileExists( archiveFile ) );
}

代码示例来源:origin: org.neo4j/neo4j-io

if ( isEmptyDirectory( fileSystem, sourceToCompress ) )

代码示例来源:origin: neo4j/neo4j

@Test
public void supportSpacesInDestinationPath() throws IOException
{
  File archiveFile = testDirectory.file( "file archive.zip" );
  File aFile = testDirectory.file( "a" );
  fileSystem.create( aFile ).close();
  ZipUtils.zip( fileSystem, aFile, archiveFile );
}

代码示例来源:origin: neo4j/neo4j

@Test
void doNotCreateZipArchiveForEmptyDirectory() throws IOException
{
  File archiveFile = testDirectory.file( "archive.zip" );
  File emptyDirectory = testDirectory.directory( "emptyDirectory" );
  ZipUtils.zip( fileSystem, emptyDirectory, archiveFile );
  assertFalse( fileSystem.fileExists( archiveFile ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
void archiveDirectory() throws IOException
{
  File archiveFile = testDirectory.file( "directoryArchive.zip" );
  File directory = testDirectory.directory( "directory" );
  fileSystem.create( new File( directory, "a" ) ).close();
  fileSystem.create( new File( directory, "b" ) ).close();
  ZipUtils.zip( fileSystem, directory, archiveFile );
  assertTrue( fileSystem.fileExists( archiveFile ) );
  assertEquals( 2, countArchiveEntries( archiveFile ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
void archiveDirectoryWithSubdirectories() throws IOException
{
  File archiveFile = testDirectory.file( "directoryWithSubdirectoriesArchive.zip" );
  File directoryArchive = testDirectory.directory( "directoryWithSubdirs" );
  File subdir1 = new File( directoryArchive, "subdir1" );
  File subdir2 = new File( directoryArchive, "subdir" );
  fileSystem.mkdir( subdir1 );
  fileSystem.mkdir( subdir2 );
  fileSystem.create( new File( directoryArchive, "a" ) ).close();
  fileSystem.create( new File( directoryArchive, "b" ) ).close();
  fileSystem.create( new File( subdir1, "c" ) ).close();
  fileSystem.create( new File( subdir2, "d" ) ).close();
  ZipUtils.zip( fileSystem, directoryArchive, archiveFile );
  assertTrue( fileSystem.fileExists( archiveFile ) );
  assertEquals( 6, countArchiveEntries( archiveFile ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
void archiveFile() throws IOException
{
  File archiveFile = testDirectory.file( "fileArchive.zip" );
  File aFile = testDirectory.file( "a" );
  fileSystem.create( aFile ).close();
  ZipUtils.zip( fileSystem, aFile, archiveFile );
  assertTrue( fileSystem.fileExists( archiveFile ) );
  assertEquals( 1, countArchiveEntries( archiveFile ) );
}

代码示例来源:origin: neo4j/neo4j

ZipUtils.zip( globalFs.get(), storeFile, globalDir.file( zipName ) );
tellDeveloperToCommitThisFormatVersion( zipName );
ZipUtils.zip( globalFs.get(), storeFile, globalDir.file( zipName ) );

代码示例来源:origin: org.neo4j/neo4j-kernel

/**
   * Deletes index folder with the specific indexId, but has the option to first archive the index if it exists.
   * The zip archive will be placed next to the root directory for that index with a timestamp included in its name.
   *
   * @param fs {@link FileSystemAbstraction} this index lives in.
   * @param directoryStructure {@link IndexDirectoryStructure} knowing the directory structure for the provider owning the index.
   * @param indexId id of the index.
   * @param archiveIfExists whether or not to archive the index before deleting it, if it exists.
   * @return whether or not an archive was created.
   * @throws IOException on I/O error.
   */
  public static boolean deleteIndex( FileSystemAbstraction fs, IndexDirectoryStructure directoryStructure, long indexId, boolean archiveIfExists )
      throws IOException
  {
    File rootIndexDirectory = directoryStructure.directoryForIndex( indexId );
    if ( archiveIfExists && fs.isDirectory( rootIndexDirectory ) && fs.fileExists( rootIndexDirectory ) && fs.listFiles( rootIndexDirectory ).length > 0 )
    {
      ZipUtils.zip( fs, rootIndexDirectory,
          new File( rootIndexDirectory.getParent(), "archive-" + rootIndexDirectory.getName() + "-" + System.currentTimeMillis() + ".zip" ) );
      return true;
    }
    fs.deleteRecursively( rootIndexDirectory );
    return false;
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com