gpt4 book ai didi

org.apache.tools.zip.ZipFile.getInputStream()方法的使用及代码示例

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

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

ZipFile.getInputStream介绍

[英]Returns an InputStream for reading the contents of the given entry.
[中]返回用于读取给定条目内容的InputStream。

代码示例

代码示例来源:origin: jenkinsci/jenkins

mkdirs(p);
try (InputStream input = zip.getInputStream(e)) {
  IOUtils.copy(input, writing(f));

代码示例来源:origin: org.apache.ant/ant

.fromJarURI(uri), "UTF-8");
  inputStream =
    zf.getInputStream(zf.getEntry(uri.substring(pling + 2)));
} else {
  URLConnection conn = url.openConnection();

代码示例来源:origin: org.apache.ant/ant

try {
  extractFile(fileUtils, srcF, dir,
        is = zf.getInputStream(ze), //NOSONAR
        ze.getName(), new Date(ze.getTime()),
        ze.isDirectory(), mapper);

代码示例来源:origin: org.apache.ant/ant

/**
 * Add a file entry.
 */
private void addResource(final Resource r, final String name, final String prefix,
             final ZipOutputStream zOut, final int mode,
             final ZipFile zf, final File fromArchive)
  throws IOException {
  if (zf != null) {
    final ZipEntry ze = zf.getEntry(r.getName());
    if (ze != null) {
      final boolean oldCompress = doCompress;
      if (keepCompression) {
        doCompress = (ze.getMethod() == ZipEntry.DEFLATED);
      }
      try (final BufferedInputStream is = new BufferedInputStream(zf.getInputStream(ze))) {
        zipFile(is, zOut, prefix + name, ze.getTime(),
            fromArchive, mode, ze.getExtraFields(true));
      } finally {
        doCompress = oldCompress;
      }
    }
  } else {
    try (final BufferedInputStream is = new BufferedInputStream(r.getInputStream())) {
      zipFile(is, zOut, prefix + name, r.getLastModified(),
          fromArchive, mode, r instanceof ZipResource
          ? ((ZipResource) r).getExtraFields() : null);
    }
  }
}

代码示例来源:origin: org.apache.ant/ant

+ getArchive());
return new FilterInputStream(z.getInputStream(ze)) {
  public void close() throws IOException {
    FileUtils.close(in);

代码示例来源:origin: sanluan/PublicCMS

if (!targetFile.exists() || overwrite) {
  targetFile.getParentFile().mkdirs();
  try (InputStream inputStream = zipFile.getInputStream(zipEntry);
      FileOutputStream outputStream = new FileOutputStream(targetFile);
      FileLock fileLock = outputStream.getChannel().tryLock();) {

代码示例来源:origin: sanluan/PublicCMS

if (!targetFile.exists() || overwrite) {
  targetFile.getParentFile().mkdirs();
  try (InputStream inputStream = zipFile.getInputStream(zipEntry);
      FileOutputStream outputStream = new FileOutputStream(targetFile);
      FileLock fileLock = outputStream.getChannel().tryLock();) {

代码示例来源:origin: org.kantega.openaksess/openaksess-core

private byte[] getDataFromZipFileEntry(ZipFile zipFile, ZipEntry entry) throws IOException {
  InputStream zis = zipFile.getInputStream(entry);
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  byte[] buf = new byte[1024];
  int len;
  while ((len = zis.read(buf)) > 0) {
    bos.write(buf, 0, len);
  }
  byte[] data = bos.toByteArray();
  bos.close();
  return data;
}

代码示例来源:origin: org.gradle/gradle-core

public InputStream open() {
  try {
    return zip.getInputStream(entry);
  } catch (IOException e) {
    throw new UncheckedIOException(e);
  }
}

代码示例来源:origin: gradle.plugin.com.bettycc.umengauto/core

private static Map<ZipEntry, byte[]> readZipAllEntry(ZipFile file) throws Exception {
    Map<ZipEntry, byte[]> entryMaps = new HashMap<ZipEntry, byte[]>();
    Enumeration<? extends ZipEntry> entries = file.getEntries();
    while (entries.hasMoreElements()) {
      ZipEntry entry = entries.nextElement();

      int len = -1;
      byte[] data = new byte[512];
      InputStream istream = file.getInputStream(entry);
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      while ((len = istream.read(data, 0, 512)) != -1) {
        bos.write(data, 0, len);
      }
      bos.close();
      istream.close();

      byte[] result = bos.toByteArray();
      entryMaps.put(entry, result);
    }
    return entryMaps;
  }
}

代码示例来源:origin: com.github.javahaohao/utils

inputStream = zipFile.getInputStream(entry);
fileOut = new FileOutputStream(destFile);
byte[] buf = new byte[bufSize];

代码示例来源:origin: net.mingsoft/ms-util

ZipEntry entry = (ZipEntry) entries.nextElement();
String zipEntryName = entry.getName();
InputStream in = zip.getInputStream(entry);
String outPath = (descDir + zipEntryName).replaceAll("\\*", "/");
outPath = new String(outPath.getBytes("utf-8"), "ISO8859-1");

代码示例来源:origin: GaoFeiGit/xutils

inputStream = zf.getInputStream(entry);

代码示例来源:origin: com.github.javahaohao/utils

inputStream = zipFile.getInputStream(zipEntry);
fileOut = new FileOutputStream(file);
while ((readedBytes = inputStream.read(buf)) > 0) {

代码示例来源:origin: com.github.tianjing/tgtools.core

new FileOutputStream(decompressDir + "/" + entryName));
bi = new BufferedInputStream(zf.getInputStream(ze2));
byte[] readContent = new byte[1024];
int readCount = bi.read(readContent);

代码示例来源:origin: qq53182347/liugh-parent

} else {
  is = zipFile.getInputStream((ZipEntry) zipEnt);
  bis = new BufferedInputStream(is);
  gbkPath = zipEnt.getName();

代码示例来源:origin: net.mingsoft/ms-util

is = zipFile.getInputStream(entry);
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos, buffer);

代码示例来源:origin: GaoFeiGit/xutils

inputStream = zf.getInputStream(entry);

代码示例来源:origin: net.wasdev.wlp.ant/wlp-anttasks

private static void unzipToDirectory(ZipFile zipFile, File destDir) throws IOException {
  byte[] buffer = new byte[4096];
  Enumeration entries = zipFile.getEntries();
  while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry) entries.nextElement();
    if (entry.isDirectory()) {
      File dir = new File(destDir, entry.getName());
      InstallUtils.createDirectory(dir);
    } else {
      File file = new File(destDir, entry.getName());
      InstallUtils.createDirectory(file.getParentFile());
      OutputStream out = null;
      InputStream in = null;
      try {
        out = new BufferedOutputStream(new FileOutputStream(file));
        in = zipFile.getInputStream(entry);
        Unzip.copy(in, out, buffer);
      } finally {
        InstallUtils.close(in);
        InstallUtils.close(out);
      }
      Unzip.setFilePermissions(file, entry);
    }
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

mkdirs(p);
try (InputStream input = zip.getInputStream(e)) {
  IOUtils.copy(input, writing(f));

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