org.apache.poi.openxml4j.opc.internal.ZipHelper.getZipItemNameFromOPCName()方法的使用及代码示例

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

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

ZipHelper.getZipItemNameFromOPCName介绍

[英]Convert an OPC item name into a zip item name by removing any leading forward slash if it exist.
[中]通过删除任何前导正斜杠(如果存在),将OPC项目名称转换为zip项目名称。

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
  public boolean marshall(PackagePart part, OutputStream out)
      throws OpenXML4JException {
    if (!(out instanceof ZipArchiveOutputStream)) {
      throw new IllegalArgumentException("ZipOutputStream expected!");
    }
    ZipArchiveOutputStream zos = (ZipArchiveOutputStream) out;

    // Saving the part in the zip file
    ZipArchiveEntry ctEntry = new ZipArchiveEntry(ZipHelper
        .getZipItemNameFromOPCName(part.getPartName().getURI()
            .toString()));
    try {
      // Save in ZIP
      zos.putArchiveEntry(ctEntry); // Add entry in ZIP
      try {
        super.marshall(part, out); // Marshall the properties inside a XML
        // Document
        return StreamHelper.saveXmlInStream(xmlDoc, out);
      } finally {
        zos.closeArchiveEntry();
      }
    } catch (IOException e) {
      throw new OpenXML4JException(e.getLocalizedMessage(), e);
    }
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

.getZipItemNameFromOPCName(part.getPartName().getURI()
        .getPath()));
try {

代码示例来源:origin: org.apache.poi/poi-ooxml

LOG.log(POILogger.DEBUG,"Save part '" + ZipHelper.getZipItemNameFromOPCName(ppn.getName()) + "'");
final PartMarshaller marshaller = partMarshallers.get(part._contentType);

代码示例来源:origin: jbaliuka/x4j-analytic

private String getEntryName(PackagePart packagePart) {
  return ZipHelper.getZipItemNameFromOPCName(packagePart.getPartName().getName());
}

代码示例来源:origin: jbaliuka/x4j-analytic

private String getEntryName(PackagePart packagePart) {
  return ZipHelper.getZipItemNameFromOPCName(packagePart.getPartName().getName());
}

代码示例来源:origin: jbaliuka/x4j-analytic

private String getEntryName(PackagePart packagePart) {
  return ZipHelper.getZipItemNameFromOPCName(packagePart.getPartName().getName());
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

@Override
  public boolean marshall(PackagePart part, OutputStream out)
      throws OpenXML4JException {
    if (!(out instanceof ZipOutputStream)) {
      throw new IllegalArgumentException("ZipOutputStream expected!");
    }
    ZipOutputStream zos = (ZipOutputStream) out;

    // Saving the part in the zip file
    ZipEntry ctEntry = new ZipEntry(ZipHelper
        .getZipItemNameFromOPCName(part.getPartName().getURI()
            .toString()));
    try {
      // Save in ZIP
      zos.putNextEntry(ctEntry); // Add entry in ZIP
      super.marshall(part, out); // Marshall the properties inside a XML
      // Document
      if (!StreamHelper.saveXmlInStream(xmlDoc, out)) {
        return false;
      }
      zos.closeEntry();
    } catch (IOException e) {
      throw new OpenXML4JException(e.getLocalizedMessage());
    }
    return true;
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

.getZipItemNameFromOPCName(part.getPartName().getURI()
        .getPath()));
try {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
  public boolean marshall(PackagePart part, OutputStream out)
      throws OpenXML4JException {
    if (!(out instanceof ZipArchiveOutputStream)) {
      throw new IllegalArgumentException("ZipOutputStream expected!");
    }
    ZipArchiveOutputStream zos = (ZipArchiveOutputStream) out;

    // Saving the part in the zip file
    ZipArchiveEntry ctEntry = new ZipArchiveEntry(ZipHelper
        .getZipItemNameFromOPCName(part.getPartName().getURI()
            .toString()));
    try {
      // Save in ZIP
      zos.putArchiveEntry(ctEntry); // Add entry in ZIP
      try {
        super.marshall(part, out); // Marshall the properties inside a XML
        // Document
        return StreamHelper.saveXmlInStream(xmlDoc, out);
      } finally {
        zos.closeArchiveEntry();
      }
    } catch (IOException e) {
      throw new OpenXML4JException(e.getLocalizedMessage(), e);
    }
  }
}

代码示例来源:origin: jbaliuka/x4j-analytic

public void processSheets(	ReportContext reportContext, List<String> savedParts, ZipContentTypeManager manager	)
    throws  Exception {
  for(int i = 0; i < workBook.getNumberOfSheets(); i++){
    XLSXSheet sheet = (XLSXSheet) nextSheet(reportContext, savedParts, i);
    CommentsTable comments = sheet.getCommentsTable(false);
    if(comments != null){
      String entryName = ZipHelper.getZipItemNameFromOPCName(comments.getPackagePart().getPartName().getName());
      savedParts.add(entryName);
      out.putNextEntry(new ZipEntry(entryName));
      comments.writeTo(out);
      out.closeEntry();
    }
    if (sheet.getPackagePart().hasRelationships()) {
      PackagePartName relationshipPartName = PackagingURIHelper
          .getRelationshipPartName(sheet.getPackagePart().getPartName());
      ZipPartMarshaller.marshallRelationshipPart(sheet.getPackagePart().getRelationships(),
          relationshipPartName, out);
      savedParts.add(relationshipPartName.getName());
      for (PackageRelationship next : sheet.getPackagePart().getRelationships()) {
        PackagePartName name = PackagingURIHelper.createPartName(next.getTargetURI());
        XSSFRelation type = XSSFRelation.getInstance(next.getRelationshipType());
        if (type != null) {
          manager.addContentType(name, type.getContentType());
        }
      }
    }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

.getZipItemNameFromOPCName(part.getPartName().getURI()
        .getPath()));
try {

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

+ ZipHelper.getZipItemNameFromOPCName(part
        .getPartName().getName()) + "'");
PartMarshaller marshaller = partMarshallers

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

LOG.log(POILogger.DEBUG,"Save part '" + ZipHelper.getZipItemNameFromOPCName(ppn.getName()) + "'");
final PartMarshaller marshaller = partMarshallers.get(part._contentType);

相关文章