示例#1
0
 private Resource processPackageResource(
     String packageResourceHref, Book book, Resources resources) {
   Resource packageResource = resources.remove(packageResourceHref);
   try {
     PackageDocumentReader.read(packageResource, this, book, resources);
   } catch (Exception e) {
     log.error(e.getMessage(), e);
   }
   return packageResource;
 }
示例#2
0
  private String getPackageResourceHref(Resources resources) {
    String defaultResult = "OEBPS/content.opf";
    String result = defaultResult;

    Resource containerResource = resources.remove("META-INF/container.xml");
    if (containerResource == null) {
      return result;
    }
    try {
      Document document = ResourceUtil.getAsDocument(containerResource);
      Element rootFileElement =
          (Element)
              ((Element) document.getDocumentElement().getElementsByTagName("rootfiles").item(0))
                  .getElementsByTagName("rootfile")
                  .item(0);
      result = rootFileElement.getAttribute("full-path");
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
    if (StringUtil.isBlank(result)) {
      result = defaultResult;
    }
    return result;
  }
示例#3
0
 private void handleMimeType(Book result, Resources resources) {
   resources.remove("mimetype");
 }