de.schlichtherle.truezip.zip.ZipFile.close()方法的使用及代码示例

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

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

ZipFile.close介绍

暂无

代码示例

代码示例来源:origin: org.jboss.windup.org.apache.maven.indexer/indexer-core

public void close()
  throws IOException
{
  getZipFile().close();
}

代码示例来源:origin: apache/maven-indexer

public void close()
  throws IOException
{
  getZipFile().close();
}

代码示例来源:origin: org.apache.maven.indexer/indexer-core

public void close()
  throws IOException
{
  getZipFile().close();
}

代码示例来源:origin: uk.gov.nationalarchives/droid-results

zip.close();

代码示例来源:origin: digital-preservation/droid

zip.close();

代码示例来源:origin: uk.gov.nationalarchives/droid-core-interfaces

/**
 * {@inheritDoc}
 */
@Override
public void handle(IdentificationRequest request) throws IOException {
  final ZipFile zipFile = new ZipFile(new ReaderReadOnlyFile(request.getWindowReader()));
  try {
    Iterable<ZipEntry> iterable = new Iterable<ZipEntry>() {
      @Override
      public final Iterator<ZipEntry> iterator() {
        return new ZipFileIterator(zipFile);
      }
    };

    ZipArchiveWalker walker = new ZipArchiveWalker(request.getIdentifier(), zipFile);  
    walker.walk(iterable);
  } finally {
    if (zipFile != null) {
      zipFile.close();
    }
  }
}

代码示例来源:origin: digital-preservation/droid

/**
 * {@inheritDoc}
 */
@Override
public void handle(IdentificationRequest request) throws IOException {
  final ZipFile zipFile = new ZipFile(new TrueZipReader(request.getWindowReader()));
  try {
    Iterable<ZipEntry> iterable = new Iterable<ZipEntry>() {
      @Override
      public final Iterator<ZipEntry> iterator() {
        return new ZipFileIterator(zipFile);
      }
    };

    ZipArchiveWalker walker = new ZipArchiveWalker(request.getIdentifier(), zipFile);  
    walker.walk(iterable);
  } finally {
    if (zipFile != null) {
      zipFile.close();
    }
  }
}

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

@Test
public final void testGoodGetCheckedInputStream() throws IOException {
  // Create test ZIP file.
  final String name = "entry";
  final ZipOutputStream zipOut
      = newZipOutputStream(new FileOutputStream(file));
  zipOut.putNextEntry(newEntry(name));
  zipOut.write(data);
  zipOut.close();
  final ZipFile zipIn = newZipFile(file);
  // Open checked input stream and join immediately.
  InputStream in = zipIn.getCheckedInputStream(name);
  in.close();
  // Open checked input stream and read fully, using multiple methods.
  in = zipIn.getCheckedInputStream(name);
  final int n = data.length / 4;
  in.skip(n);
  in.read(new byte[n]);
  in.read(new byte[n], 0, n);
  while (in.read() != -1) { // read until EOF
  }
  in.close();
  zipIn.close();
}

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

@Test
public final void testWriteAndReadSingleBytes() throws IOException {
  final ZipOutputStream zipOut
      = newZipOutputStream(new FileOutputStream(file));
  zipOut.putNextEntry(newEntry("file"));
  for (int i = 0; i < data.length; i++)
    zipOut.write(data[i]);
  zipOut.close();
  final ZipFile zipIn = newZipFile(file);
  InputStream in = zipIn.getInputStream("file");
  for (int i = 0, c; (c = in.read()) != -1; i++)
    assertEquals(data[i] & 0xFF, c);
  in.close();
  zipIn.close();
}

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

@Test
public final void testPreambleOfEmptyZipFile() throws IOException {
  // Create empty ZIP file.
  newZipOutputStream(new FileOutputStream(file)).close();
  // Assert that the empty ZIP file has no preamble.
  final ZipFile zipIn = newZipFile(file);
  try {
    assertEquals(0, zipIn.getPreambleLength());
    final InputStream in = zipIn.getPreambleInputStream();
    try {
      assertEquals(-1, in.read());
    } finally {
      in.close();
    }
  } finally {
    zipIn.close();
  }
}

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

private void append(
      final int off,
      final int len,
      final byte[] data)
  throws IOException {
    final ZipOutputStream out;
    if (file.exists()) {
      final ZipFile in = newZipFile(file);
      in.close();
      out = newZipOutputStream(new FileOutputStream(file, true), in);
    } else {
      out = newZipOutputStream(new FileOutputStream(file));
    }
    try {
      for (int i = 0; i < len; i++) {
        final String name = off + i + ".txt";
        out.putNextEntry(newEntry(name));
        out.write(data);
      }
    } finally {
      out.close();
    }
  }
}

代码示例来源:origin: digital-preservation/droid

zipFile.close();

代码示例来源:origin: uk.gov.nationalarchives/droid-container

zipFile.close();

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

zipIn.close();

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

@Test
public final void testGetInputStream() throws IOException {
  final ZipOutputStream zipOut
      = newZipOutputStream(new FileOutputStream(file));
  try {
    zipOut.putNextEntry(newEntry("foo"));
  } finally {
    zipOut.close();
  }
  final ZipFile zipIn = newZipFile(file);
  try {
    zipIn.getInputStream("foo").close();
    assertNull(zipIn.getInputStream("bar"));
  } finally {
    zipIn.close();
  }
}

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

zin.close();

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

runConcurrent(nThreads, new CheckAllEntriesFactory()).join();
} finally {
  zin.close();

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

zipIn.close();

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

zf.close();

相关文章