gpt4 book ai didi

de.schlichtherle.truezip.fs.archive.zip.ZipDriver类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 16:29:31 29 4
gpt4 key购买 nike

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

ZipDriver介绍

[英]An archive driver for ZIP files. By default, ZIP files use the IBM437 character set for the encoding of entry names and comments (unless the General Purpose Bit 11 is present in accordance with appendix D of the ZIP File Format Specification). They also apply the date/time conversion rules according to DateTimeConverter#ZIP. This configuration pretty much constraints the applicability of this driver to North American and Western European countries. However, this driver generally provides best interoperability with third party tools like the Windows Explorer, WinZip, 7-Zip etc. To some extent this applies even outside these countries. Therefore, while you should use this driver to access plain old ZIP files, you should not use it for custom application file formats - use the JarDriver instead in this case.

This driver does not check the CRC value of any entries in existing archives - use CheckedZipDriver instead.

Sub-classes must be thread-safe and should be immutable!
[中]压缩文件的存档驱动程序。默认情况下,ZIP文件使用IBM437字符集对条目名称和注释进行编码(除非根据ZIP File Format Specification的附录D存在通用位11)。他们还根据DateTimeConverter#ZIP应用日期/时间转换规则。这种配置在很大程度上限制了该驱动程序在北美和西欧国家的适用性。然而,该驱动程序通常提供与第三方工具(如Windows Explorer、WinZip、7-Zip等)的最佳互操作性。在某种程度上,这甚至适用于这些国家以外的国家。因此,虽然您应该使用这个驱动程序来访问普通的旧ZIP文件,但您不应该将其用于自定义应用程序文件格式——在这种情况下,请使用JarDriver。
此驱动程序检查现有存档中任何条目的CRC值-使用CheckedZipDriver。
子类必须是线程安全的,并且应该是不可变的!

代码示例

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

/**
 * {@inheritDoc}
 * <p>
 * The implementation in the class {@link FsArchiveDriver} calls
 * {@link #superNewController} a
 * partial file system controller chain and passes the result to
 * {@link #decorate} for further decoration.
 */
@Override
public FsController<?> newController(FsModel model, FsController<?> parent) {
  return decorate(superNewController(model, parent));
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

private <K> KeyManager<K> keyManager(Class<K> type) {
  return driver.getKeyManagerProvider().get(type);
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

private IOPool<?> getIOPool() {
  return driver.getPool();
}

代码示例来源:origin: Alfresco/alfresco-repository

public WarHelperImplTest()
{
  super(new LogOutput()
  {            
    @Override
    public void info(Object message)
    {
      System.out.println(message);
    }
  });
  
  TConfig config = TConfig.get();
  config.setArchiveDetector(new TArchiveDetector("war|amp", new ZipDriver(IOPoolLocator.SINGLETON)));
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

final BitField<FsOutputOption> mknod)
throws CharConversionException {
  name = toZipOrTarEntryName(name, type);
  final ZipDriverEntry entry;
  if (template instanceof ZipEntry) {
    entry = newEntry(name, (ZipEntry) template);
  } else {
    entry = newEntry(name);
    if (null != template) {
      entry.setTime(template.getTime(WRITE));
      if (mknod.get(COMPRESS)) method = DEFLATED;
      else if (mknod.get(STORE)) method = STORED;
      else method = getMethod();
      entry.setMethod(method);
      if (STORED != method) entry.setCompressedSize(UNKNOWN);

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@Override
  public void sync(final BitField<FsSyncOption> options)
  throws FsSyncException {
    delegate.sync(options);
    final KeyManager<?> manager = getKeyManager();
    final URI resource = driver.mountPointUri(getModel());
    final KeyProvider<?> provider;
    if (manager instanceof SafeKeyManager) {
      // Don't create a key provider if there wasn't one mapped already.
      provider = ((SafeKeyManager) manager).getMappedKeyProvider(resource);
    } else {
      // TODO: This might create a memory leak.
      // It's unlikely that a third party implements the KeyManager
      // interface and does NOT use extend the SafeKeyManager class,
      // though.
      provider = manager.getKeyProvider(resource);
    }
    if (null != provider)
      driver.getKeyProviderSyncStrategy().sync(provider);
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

/**
 * A template method which derives the resource URI for looking up a
 * {@link KeyProvider} from the given file system model and entry name.
 * <p>
 * The implementation in the class {@code ZipDriver} ignores the given
 * entry name and just returns the expression {@code mountPointUri(model)}
 * in order to lookup the same key provider for all entries in a ZIP file.
 * <p>
 * An alternative implementation in a sub-class could return the expression
 * {@code mountPointUri(model).resolve("/" + name)} instead.
 *
 * @param  model the file system model.
 * @param  name the entry name.
 * @return The URI for looking up a {@link KeyProvider}.
 */
public URI resourceUri(FsModel model, String name) {
  //return mountPointUri(model).resolve("/" + name);
  return mountPointUri(model);
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

/**
 * {@inheritDoc}
 * <p>
 * The implementation in the class {@link ZipDriver} acquires a read only
 * file from the given socket and forwards the call to
 * {@link #newInputShop}.
 */
@Override
public InputShop<ZipDriverEntry> newInputShop(
    final FsModel model,
    final InputSocket<?> input)
throws IOException {
  if (null == model)
    throw new NullPointerException();
  final ReadOnlyFile rof = input.newReadOnlyFile();
  try {
    return newInputShop(model, rof);
  } catch (final IOException ex) {
    try {
      rof.close();
    } catch (final IOException ex2) {
      if (JSE7.AVAILABLE) ex.addSuppressed(ex2);
    }
    throw ex;
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@Override
public FsEntry getEntry(final FsEntryName name)
throws IOException {
  try {
    return delegate.getEntry(name);
  } catch (final ControlFlowException ex) {
    if (!name.isRoot() || null == findKeyException(ex)) throw ex;
    Entry entry = getParent().getEntry(
        getModel()
          .getMountPoint()
          .getPath()
          .resolve(name)
          .getEntryName());
    // We're not holding any locks, so it's possible that someone else
    // has concurrently modified the parent file system.
    if (null == entry) return null;
    // The entry is inaccessible for some reason.
    // This may be because the cipher key is not available.
    // Now mask the entry as a special file.
    while (entry instanceof FsCovariantEntry<?>)
      entry = ((FsCovariantEntry<?>) entry).getEntry();
    final FsCovariantEntry<FsArchiveEntry>
        special = new FsCovariantEntry<FsArchiveEntry>(ROOT_PATH);
    special.put(SPECIAL, driver.newEntry(ROOT_PATH, SPECIAL, entry));
    return special;
  }
}

代码示例来源:origin: org.codehaus.mojo/truezip-utils

@PostConstruct
  public void init()
  {

    TConfig.get().setArchiveDetector( new TArchiveDetector( TArchiveDetector.NULL, new Object[][] {
                       { "tar|ova", new TarDriver( IOPoolLocator.SINGLETON ) },
                       { "tgz|tar.gz", new TarGZipDriver( IOPoolLocator.SINGLETON ) },
                       { "tbz2|tar.bz2", new TarBZip2Driver( IOPoolLocator.SINGLETON ) },
                       { "zip|kar", new ZipDriver( IOPoolLocator.SINGLETON ) },
                       { "jar|war|ear|sar|swc|nar|esb|par",
                         new JarDriver( IOPoolLocator.SINGLETON ) }, } ) );
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@CreatesObligation
protected InputShop<ZipDriverEntry> newInputShop(
    FsModel model,
    @WillCloseWhenClosed ReadOnlyFile rof)
throws IOException {
  assert null != model;
  final ZipInputShop input = new ZipInputShop(this, model, rof);
  try {
    input.recoverLostEntries();
  } catch (final IOException ex) {
    logger.log(Level.WARNING, "junkInTheTrunk.warning", new Object[] {
      mountPointUri(model),
      input.getPostambleLength(),
    });
    logger.log(Level.FINE, "junkInTheTrunk.fine", ex);
  }
  return input;
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@Override
  protected ZipDriver newArchiveDriver() {
    return new ZipDriver(getTestConfig().getIOPoolProvider());
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

private KeyManager<?> getKeyManager() {
  final KeyManager<?> manager = this.manager;
  return null != manager
      ? manager
      : (this.manager = driver.getKeyManagerProvider()
        .get(getKeyType()));
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@CreatesObligation
  @edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION")
  protected OutputShop<ZipDriverEntry> newOutputShop(
      FsModel model,
      @WillCloseWhenClosed OutputStream out,
      @CheckForNull @WillNotClose ZipInputShop source)
  throws IOException {
    return new MultiplexedOutputShop<ZipDriverEntry>(
        new ZipOutputShop(this, model, out, source),
        getPool());
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@Override
  protected ZipDriver newArchiveDriver() {
    return new ZipDriver(getTestConfig().getIOPoolProvider());
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@Override
  protected ZipDriver newArchiveDriver() {
    return new ZipDriver(getTestConfig().getIOPoolProvider());
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@Override
protected ZipDriver newArchiveDriver() {
  return new ZipDriver(getTestConfig().getIOPoolProvider());
}

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