org.apache.commons.vfs2.provider.zip.ZipFileSystemConfigBuilder.getInstance()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(123)

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

ZipFileSystemConfigBuilder.getInstance介绍

暂无

代码示例

代码示例来源:origin: apache/commons-vfs

/**
   * Return config builder.
   *
   * @return A config builder for ZipFileProvider.
   * @see org.apache.commons.vfs2.provider.AbstractFileProvider#getConfigBuilder()
   */
  @Override
  public FileSystemConfigBuilder getConfigBuilder() {
    return ZipFileSystemConfigBuilder.getInstance();
  }
}

代码示例来源:origin: apache/commons-vfs

public ZipFileSystem(final AbstractFileName rootName, final FileObject parentLayer,
    final FileSystemOptions fileSystemOptions) throws FileSystemException {
  super(rootName, parentLayer, fileSystemOptions);
  
  // Make a local copy of the file
  file = parentLayer.getFileSystem().replicateFile(parentLayer, Selectors.SELECT_SELF);
  this.charset = ZipFileSystemConfigBuilder.getInstance().getCharset(fileSystemOptions);
  
  // Open the Zip file
  if (!file.exists()) {
    // Don't need to do anything
    zipFile = null;
    return;
  }
}

代码示例来源:origin: apache/commons-vfs

/**
   * Returns the base folder for read tests.
   */
  @Override
  public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
    final FileSystemOptions opts = new FileSystemOptions();
    final ZipFileSystemConfigBuilder builder = ZipFileSystemConfigBuilder.getInstance();
    // Tests the same charset as the default but we exercise having a Charset set.
    builder.setCharset(opts, StandardCharsets.UTF_8);

    final File zipFile = AbstractVfsTestCase.getTestResource("test.zip");
    final String uri = "zip:file:" + zipFile.getAbsolutePath() + "!/";
    FileObject resolvedFile = manager.resolveFile(uri, opts);
    FileSystem fileSystem = resolvedFile.getFileSystem();
    Assert.assertTrue(fileSystem instanceof ZipFileSystem);
    ZipFileSystem zipFileSystem = (ZipFileSystem) fileSystem;
    Assert.assertEquals(StandardCharsets.UTF_8, zipFileSystem.getCharset());
    return resolvedFile;
  }
}

代码示例来源:origin: apache/commons-vfs

/**
   * Returns the base folder for read tests.
   */
  @Override
  public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
    final FileSystemOptions opts = new FileSystemOptions();
    final ZipFileSystemConfigBuilder builder = ZipFileSystemConfigBuilder.getInstance();
    // Tests null as the default.
    builder.setCharset(opts, null);

    final File zipFile = AbstractVfsTestCase.getTestResource("test.zip");
    final String uri = "zip:file:" + zipFile.getAbsolutePath() + "!/";
    FileObject resolvedFile = manager.resolveFile(uri, opts);
    FileSystem fileSystem = resolvedFile.getFileSystem();
    Assert.assertTrue(fileSystem instanceof ZipFileSystem);
    ZipFileSystem zipFileSystem = (ZipFileSystem) fileSystem;
    Assert.assertEquals(null, zipFileSystem.getCharset());
    return resolvedFile;
  }
}

相关文章

ZipFileSystemConfigBuilder类方法