com.liferay.portal.kernel.zip.ZipReader类的使用及代码示例

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

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

ZipReader介绍

暂无

代码示例

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

/**
 * @deprecated As of Judson (7.1.x), with no direct replacement
 */
@Deprecated
@Override
public List<String> getZipEntries() {
  return getZipReader().getEntries();
}

代码示例来源:origin: com.liferay.portal/portal-kernel

public String getEntryAsString(String name) {
  byte[] bytes = getEntryAsByteArray(name);
  if (bytes != null) {
    return new String(bytes);
  }
  return null;
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

@Override
public InputStream getZipEntryAsInputStream(String path) {
  if (!Validator.isFilePath(path, false)) {
    return null;
  }
  return getZipReader().getEntryAsInputStream(path);
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

/**
 * @deprecated As of Judson (7.1.x), replaced by {@link
 *             #getManifestSummary(PortletDataContext)}
 */
@Deprecated
@Override
public ManifestSummary getManifestSummary(
    long userId, long groupId, Map<String, String[]> parameterMap,
    File file)
  throws Exception {
  final Group group = _groupLocalService.getGroup(groupId);
  String userIdStrategy = MapUtil.getString(
    parameterMap, PortletDataHandlerKeys.USER_ID_STRATEGY);
  ZipReader zipReader = ZipReaderFactoryUtil.getZipReader(file);
  PortletDataContext portletDataContext =
    _portletDataContextFactory.createImportPortletDataContext(
      group.getCompanyId(), groupId, parameterMap,
      getUserIdStrategy(userId, userIdStrategy), zipReader);
  try {
    return getManifestSummary(portletDataContext);
  }
  finally {
    zipReader.close();
  }
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

@Override
public String getZipEntryAsString(String path) {
  if (!Validator.isFilePath(path, false)) {
    return null;
  }
  return getZipReader().getEntryAsString(path);
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

@Override
public List<String> getZipFolderEntries(String path) {
  if (!Validator.isFilePath(path, false)) {
    return null;
  }
  return getZipReader().getFolderEntries(path);
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

/**
 * @deprecated As of Judson (7.1.x), replaced by {@link
 *             #validateMissingReferences(PortletDataContext)}
 */
@Deprecated
@Override
public MissingReferences validateMissingReferences(
    long userId, long groupId, Map<String, String[]> parameterMap,
    File file)
  throws Exception {
  Group group = _groupLocalService.getGroup(groupId);
  String userIdStrategy = MapUtil.getString(
    parameterMap, PortletDataHandlerKeys.USER_ID_STRATEGY);
  ZipReader zipReader = ZipReaderFactoryUtil.getZipReader(file);
  PortletDataContext portletDataContext =
    _portletDataContextFactory.createImportPortletDataContext(
      group.getCompanyId(), groupId, parameterMap,
      getUserIdStrategy(userId, userIdStrategy), zipReader);
  try {
    return validateMissingReferences(portletDataContext);
  }
  finally {
    zipReader.close();
  }
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

String xml = zipReader.getEntryAsString("/manifest.xml");

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

zipReader.close();

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

ZipReader zipReader = portletDataContext.getZipReader();
List<String> entries = zipReader.getEntries();

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

@Override
public byte[] getZipEntryAsByteArray(String path) {
  if (!Validator.isFilePath(path, false)) {
    return null;
  }
  return getZipReader().getEntryAsByteArray(path);
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

String xml = zipReader.getEntryAsString("/manifest.xml");

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

zipReader.close();

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

@Override
public ManifestSummary getManifestSummary(
    long userId, long groupId, Map<String, String[]> parameterMap,
    FileEntry fileEntry)
  throws Exception {
  File file = FileUtil.createTempFile("lar");
  ZipReader zipReader = null;
  ManifestSummary manifestSummary = null;
  try (InputStream inputStream = _dlFileEntryLocalService.getFileAsStream(
      fileEntry.getFileEntryId(), fileEntry.getVersion(), false)) {
    FileUtil.write(file, inputStream);
    Group group = _groupLocalService.getGroup(groupId);
    String userIdStrategy = MapUtil.getString(
      parameterMap, PortletDataHandlerKeys.USER_ID_STRATEGY);
    zipReader = ZipReaderFactoryUtil.getZipReader(file);
    PortletDataContext portletDataContext =
      _portletDataContextFactory.createImportPortletDataContext(
        group.getCompanyId(), groupId, parameterMap,
        getUserIdStrategy(userId, userIdStrategy), zipReader);
    manifestSummary = getManifestSummary(portletDataContext);
  }
  finally {
    if (zipReader != null) {
      zipReader.close();
    }
    FileUtil.delete(file);
  }
  return manifestSummary;
}

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

zipReader.close();

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

zipReader.close();

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

zipReader.close();

代码示例来源:origin: com.liferay/com.liferay.exportimport.service

zipReader.close();

相关文章