gpt4 book ai didi

org.nuxeo.common.utils.ZipUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 12:05:31 25 4
gpt4 key购买 nike

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

ZipUtils介绍

暂无

代码示例

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(ZipInputStream in, File dir, PathFilter filter) throws IOException {
  if (filter == null) {
    unzip(in, dir);
  } else {
    unzip(in, dir, toPredicate(filter), Function.identity());
  }
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

protected static void zip(Blob blob, ZipOutputStream out) throws IOException {
  String entry = getFileName(blob);
  InputStream in = blob.getStream();
  try {
    ZipUtils._zip(entry, in, out);
  } finally {
    in.close();
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static String getEntryContentAsString(URL url, String entryName) throws IOException {
  try (InputStream resultStream = getEntryContentAsStream(url, entryName)) {
    return IOUtils.toString(resultStream, UTF_8);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void zip(File file, OutputStream out, String prefix) throws IOException {
  prefix = normalizePrefix(prefix);
  String name = normalizePrefix(prefix) + file.getName();
  try (ZipOutputStream zout = new ZipOutputStream(out)) {
    _zip(name, file, zout);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(ZipInputStream in, File dir) throws IOException {
  unzip(in, dir, entry -> true, Function.identity());
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-convert

if (!ZipUtils.isValid(blobStream)) {
  throw new ConversionException("not a valid iWork file");
if (ZipUtils.hasEntry(blobStream, IWORK_PREVIEW_FILE)) {
  try (InputStream previewPDFFile = ZipUtils.getEntryContentAsStream(blob.getStream(), IWORK_PREVIEW_FILE)) {
    previewBlob = Blobs.createBlob(previewPDFFile);

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static boolean hasEntry(URL url, String entryName) throws IOException {
  return hasEntry(url.openStream(), entryName);
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void zipFilesUsingPrefix(String prefix, File[] files, OutputStream out) throws IOException {
  try (ZipOutputStream zout = new ZipOutputStream(out)) {
    if (prefix != null && prefix.length() > 0) {
      int p = prefix.indexOf('/');
      while (p > -1) {
        _putDirectoryEntry(prefix.substring(0, p), zout);
        p = prefix.indexOf(p + 1, '/');
      }
      _putDirectoryEntry(prefix, zout);
      prefix += '/';
    } else {
      prefix = "";
    }
    // prefix = prefix + '/';
    for (File file : files) {
      _putFileEntry(file, prefix + file.getName(), zout);
    }
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, URL zip, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zip.openStream()))) {
    unzip(prefix, in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void _zip(File[] files, ZipOutputStream out, String prefix) throws IOException {
  String normalizedPrefix = normalizePrefix(prefix);
  for (File file : files) {
    String name = normalizedPrefix + file.getName();
    _zip(name, file, out);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(InputStream zipStream, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zipStream))) {
    unzip(in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, ZipInputStream in, File dir, PathFilter filter) throws IOException {
  if (filter == null) {
    unzip(prefix, in, dir);
  } else {
    unzip(in, dir, toPredicate(filter).and(entry -> entry.getName().startsWith(prefix)),
        name -> name.substring(prefix.length()));
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static String getEntryContentAsString(InputStream stream, String searchedEntryName) throws IOException {
  try (InputStream resultStream = getEntryContentAsStream(stream, searchedEntryName)) {
    return IOUtils.toString(resultStream, UTF_8);
  }
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

protected static void zip(List<Blob> blobs, ZipOutputStream out) throws IOException {
  // use a set to avoid zipping entries with same names
  Collection<String> names = new HashSet<String>();
  int cnt = 1;
  for (Blob blob : blobs) {
    String entry = getFileName(blob);
    if (!names.add(entry)) {
      entry = "renamed_" + (cnt++) + "_" + entry;
    }
    InputStream in = blob.getStream();
    try {
      ZipUtils._zip(entry, in, out);
    } finally {
      in.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, InputStream zipStream, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zipStream))) {
    unzip(prefix, in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static byte[] getEntryContentAsBytes(URL url, String entryName) throws IOException {
  try (InputStream resultStream = getEntryContentAsStream(url, entryName)) {
    return IOUtils.toByteArray(resultStream);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void _putFileEntry(File file, String entryName, ZipOutputStream out) throws IOException {
  try (FileInputStream in = new FileInputStream(file)) {
    _zip(entryName, in, out);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzipIgnoreDirs(ZipInputStream in, File dir) throws IOException {
  unzip(in, dir, entry -> !entry.isDirectory(), Function.identity());
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static byte[] getEntryContentAsBytes(InputStream stream, String searchedEntryName) throws IOException {
  try (InputStream resultStream = getEntryContentAsStream(stream, searchedEntryName)) {
    return IOUtils.toByteArray(resultStream);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void zip(File[] files, OutputStream out, String prefix) throws IOException {
  try (ZipOutputStream zout = new ZipOutputStream(out)) {
    _zip(files, zout, prefix);
  }
}

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