org.apache.commons.vfs2.provider.zip.ZipFileSystem类的使用及代码示例

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

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

ZipFileSystem介绍

[英]A read-only file system for ZIP and JAR files.
[中]用于ZIP和JAR文件的只读文件系统。

代码示例

代码示例来源:origin: org.apache.commons/commons-vfs2

@Override
  protected void doDetach() throws Exception {
    ZipFileSystem afs = getAbstractFileSystem();
    if (!afs.isOpen()) {
      afs.close();
    }
  }
}

代码示例来源:origin: org.apache.commons/commons-vfs2

protected ZipFile getZipFile() throws FileSystemException {
  if (zipFile == null && this.file.exists()) {
    this.zipFile = createZipFile(this.file);
  }
  return zipFile;
}

代码示例来源:origin: com.github.abashev/commons-vfs2

@Override
protected ZipFile getZipFile() throws FileSystemException {
  // make accessible
  return super.getZipFile();
}

代码示例来源:origin: org.apache.commons/commons-vfs2

final List<ZipFileObject> strongRef = new ArrayList<>(getZipFile().size());
final Enumeration<? extends ZipEntry> entries = getZipFile().entries();
while (entries.hasMoreElements()) {
  final ZipEntry entry = entries.nextElement();
  final AbstractFileName name = (AbstractFileName) getFileSystemManager().resolveName(getRootName(),
      UriParser.encode(entry.getName()));
  if (entry.isDirectory() && getFileFromCache(name) != null) {
    fileObj = (ZipFileObject) getFileFromCache(name);
    fileObj.setZipEntry(entry);
    continue;
  fileObj = createZipFileObject(name, entry);
  putFileToCache(fileObj);
  strongRef.add(fileObj);
  fileObj.holdObject(strongRef);
          .getParent()) {
    parent = (ZipFileObject) getFileFromCache(parentName);
    if (parent == null) {
      parent = createZipFileObject(parentName, null);
      putFileToCache(parent);
      strongRef.add(parent);
      parent.holdObject(strongRef);
closeCommunicationLink();

代码示例来源:origin: com.github.abashev/commons-vfs2

/**
 * Creates a layered file system. This method is called if the file system is not cached.
 *
 * @param scheme The URI scheme.
 * @param file The file to create the file system on top of.
 * @return The file system.
 */
@Override
protected FileSystem doCreateFileSystem(final String scheme, final FileObject file,
    final FileSystemOptions fileSystemOptions) throws FileSystemException {
  final AbstractFileName rootName = new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH,
      FileType.FOLDER);
  return new ZipFileSystem(rootName, file, fileSystemOptions);
}

代码示例来源:origin: org.apache.commons/commons-vfs2

@Override
protected void doCloseCommunicationLink() {
  // Release the zip file
  try {
    if (zipFile != null) {
      zipFile.close();
      zipFile = null;
    }
  } catch (final IOException e) {
    // getLogger().warn("vfs.provider.zip/close-zip-file.error :" + file, e);
    VfsLog.warn(getLogger(), LOG, "vfs.provider.zip/close-zip-file.error :" + file, e);
  }
}

代码示例来源:origin: com.github.abashev/commons-vfs2

final List<ZipFileObject> strongRef = new ArrayList<>(getZipFile().size());
final Enumeration<? extends ZipEntry> entries = getZipFile().entries();
while (entries.hasMoreElements()) {
  final ZipEntry entry = entries.nextElement();
  final AbstractFileName name = (AbstractFileName) getFileSystemManager().resolveName(getRootName(),
      UriParser.encode(entry.getName()));
  if (entry.isDirectory() && getFileFromCache(name) != null) {
    fileObj = (ZipFileObject) getFileFromCache(name);
    fileObj.setZipEntry(entry);
    continue;
  fileObj = createZipFileObject(name, entry);
  putFileToCache(fileObj);
  strongRef.add(fileObj);
  fileObj.holdObject(strongRef);
          .getParent()) {
    parent = (ZipFileObject) getFileFromCache(parentName);
    if (parent == null) {
      parent = createZipFileObject(parentName, null);
      putFileToCache(parent);
      strongRef.add(parent);
      parent.holdObject(strongRef);
closeCommunicationLink();

代码示例来源:origin: org.apache.commons/commons-vfs2

/**
 * Creates a layered file system. This method is called if the file system is not cached.
 *
 * @param scheme The URI scheme.
 * @param file The file to create the file system on top of.
 * @return The file system.
 */
@Override
protected FileSystem doCreateFileSystem(final String scheme, final FileObject file,
    final FileSystemOptions fileSystemOptions) throws FileSystemException {
  final AbstractFileName rootName = new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH,
      FileType.FOLDER);
  return new ZipFileSystem(rootName, file, fileSystemOptions);
}

代码示例来源:origin: com.github.abashev/commons-vfs2

@Override
protected void doCloseCommunicationLink() {
  // Release the zip file
  try {
    if (zipFile != null) {
      zipFile.close();
      zipFile = null;
    }
  } catch (final IOException e) {
    // getLogger().warn("vfs.provider.zip/close-zip-file.error :" + file, e);
    VfsLog.warn(getLogger(), LOG, "vfs.provider.zip/close-zip-file.error :" + file, e);
  }
}

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

final List<ZipFileObject> strongRef = new ArrayList<>(getZipFile().size());
final Enumeration<? extends ZipEntry> entries = getZipFile().entries();
while (entries.hasMoreElements()) {
  final ZipEntry entry = entries.nextElement();
  final AbstractFileName name = (AbstractFileName) getFileSystemManager().resolveName(getRootName(),
      UriParser.encode(entry.getName()));
  if (entry.isDirectory() && getFileFromCache(name) != null) {
    fileObj = (ZipFileObject) getFileFromCache(name);
    fileObj.setZipEntry(entry);
    continue;
  fileObj = createZipFileObject(name, entry);
  putFileToCache(fileObj);
  strongRef.add(fileObj);
  fileObj.holdObject(strongRef);
          .getParent()) {
    parent = (ZipFileObject) getFileFromCache(parentName);
    if (parent == null) {
      parent = createZipFileObject(parentName, null);
      putFileToCache(parent);
      strongRef.add(parent);
      parent.holdObject(strongRef);
closeCommunicationLink();

代码示例来源:origin: com.github.abashev/commons-vfs2

@Override
  protected void doDetach() throws Exception {
    ZipFileSystem afs = getAbstractFileSystem();
    if (!afs.isOpen()) {
      afs.close();
    }
  }
}

代码示例来源:origin: org.apache.commons/commons-vfs2

@Override
protected ZipFile getZipFile() throws FileSystemException {
  // make accessible
  return super.getZipFile();
}

代码示例来源:origin: com.github.abashev/commons-vfs2

protected ZipFile getZipFile() throws FileSystemException {
  if (zipFile == null && this.file.exists()) {
    this.zipFile = createZipFile(this.file);
  }
  return zipFile;
}

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

/**
 * Creates a layered file system. This method is called if the file system is
 * not cached.
 *
 * @param scheme The URI scheme.
 * @param file   The file to create the file system on top of.
 * @return The file system.
 */
@Override
protected FileSystem doCreateFileSystem(final String scheme, final FileObject file,
    final FileSystemOptions fileSystemOptions) throws FileSystemException {
  final AbstractFileName rootName = new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH,
      FileType.FOLDER);
  return new ZipFileSystem(rootName, file, fileSystemOptions);
}

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

@Override
protected void doCloseCommunicationLink() {
  // Release the zip file
  try {
    if (zipFile != null) {
      zipFile.close();
      zipFile = null;
    }
  } catch (final IOException e) {
    // getLogger().warn("vfs.provider.zip/close-zip-file.error :" + file, e);
    VfsLog.warn(getLogger(), LOG, "vfs.provider.zip/close-zip-file.error :" + file, e);
  }
}

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

@Override
  protected void doDetach() throws Exception {
    final ZipFileSystem afs = getAbstractFileSystem();
    if (!afs.isOpen()) {
      afs.close();
    }
  }
}

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

@Override
protected ZipFile getZipFile() throws FileSystemException {
  // make accessible
  return super.getZipFile();
}

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

protected ZipFile getZipFile() throws FileSystemException {
  if (zipFile == null && this.file.exists()) {
    this.zipFile = createZipFile(this.file);
  }
  return zipFile;
}

代码示例来源:origin: org.apache.commons/commons-vfs2

@Override
protected void doAttach() throws Exception {
  getAbstractFileSystem().getZipFile();
}

代码示例来源:origin: com.github.abashev/commons-vfs2

@Override
protected void doAttach() throws Exception {
  getAbstractFileSystem().getZipFile();
}

相关文章