Package com.adobe.dp.epub.io

Examples of com.adobe.dp.epub.io.DataSource


    this(new ZipContainerSource(file));
  }

  public Publication(ContainerSource containerSource) throws Exception {
    this.containerSource = containerSource;
    DataSource cont = containerSource.getDataSource("META-INF/container.xml");
    if (cont == null)
      throw new IOException("Not an EPUB file: META-INF/container.xml missing");
    String opfName = processOCF(cont.getInputStream());
    opf = new OPFResource(this, opfName);
    resourcesByName.put(opfName, opf);
    opf.load(containerSource, opfName);
    Iterator entries = containerSource.getResourceList();
    while (entries.hasNext()) {
View Full Code Here


      throw new RuntimeException("No OPF file found");
    return handler.opf;
  }

  Resource loadResource(String href, String mediaType) throws Exception {
    DataSource data = containerSource.getDataSource(href);
    if (data == null)
      return null;
    return createGenericResource(href, mediaType, data);
  }
View Full Code Here

  private Resource parseResourceRaw(Resource res) {
    if (res.getClass() != Resource.class)
      return null;
    String mediaType = res.getMediaType();
    DataSource data = res.source;
    String href = res.getName();
    try {
      if (mediaType.equals("application/xhtml+xml") || mediaType.equals("image/svg+xml")
          || mediaType.equals("text/html")) {
        if (mediaType.equals("text/html"))
View Full Code Here

            + " of the second chapter's first paragraph. ");
      paragraph2.add(sb2.toString());
      body2.add(paragraph2);

      // add a bitmap resource
      DataSource dataSource = new ResourceDataSource(HelloEPUB3.class,
          "cassini.jpg");
      BitmapImageResource imageResource = epub.createBitmapImageResource(
          "OPS/images/cassini.jpg", "image/jpeg", dataSource);

      // add a bitmap image
View Full Code Here

                    if(f.exists()){
                        content=Utils.getBytesFromFile(f);
                    }
                }
                if(content!=null){
                    DataSource dataSource = new ByteArrayImageDataSource(content);
   
                    BitmapImageResource imageResource = getEpub().createBitmapImageResource(
                            "OPS/images/" + System.currentTimeMillis() + (Math.random() * 100) + "." + ext, mimetype,
                            dataSource);
                    ImageElement bitmap = dstResource.getDocument().createImageElement("img");
View Full Code Here

TOP

Related Classes of com.adobe.dp.epub.io.DataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.