Package nl.siegmann.epublib.domain

Examples of nl.siegmann.epublib.domain.Book


    Assert.assertNotNull(readBook.getCoverImage());
  }

  @Test
  public void testCover_cover_one_section() throws IOException {
    Book book = new Book();

    book.setCoverImage(new Resource(this.getClass().getResourceAsStream(
        "/book1/cover.png"), "cover.png"));
    book.addSection("Introduction", new Resource(this.getClass()
        .getResourceAsStream("/book1/chapter1.html"), "chapter1.html"));
    book.generateSpineFromTableOfContents();

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    (new EpubWriter()).write(book, out);
    byte[] epubData = out.toByteArray();
    Book readBook = new EpubReader().readEpub(new ByteArrayInputStream(
        epubData));
    Assert.assertNotNull(readBook.getCoverPage());
    Assert.assertEquals(1, readBook.getSpine().size());
    Assert.assertEquals(1, readBook.getTableOfContents().size());
  }
View Full Code Here


    Assert.assertEquals(1, readBook.getTableOfContents().size());
  }

  @Test
  public void testReadEpub_opf_ncx_docs() throws IOException {
    Book book = new Book();

    book.setCoverImage(new Resource(this.getClass().getResourceAsStream(
        "/book1/cover.png"), "cover.png"));
    book.addSection("Introduction", new Resource(this.getClass()
        .getResourceAsStream("/book1/chapter1.html"), "chapter1.html"));
    book.generateSpineFromTableOfContents();

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    (new EpubWriter()).write(book, out);
    byte[] epubData = out.toByteArray();
    Book readBook = new EpubReader().readEpub(new ByteArrayInputStream(
        epubData));
    Assert.assertNotNull(readBook.getCoverPage());
    Assert.assertEquals(1, readBook.getSpine().size());
    Assert.assertEquals(1, readBook.getTableOfContents().size());
    Assert.assertNotNull(readBook.getOpfResource());
    Assert.assertNotNull(readBook.getNcxResource());
    Assert.assertEquals(MediatypeService.NCX, readBook.getNcxResource()
        .getMediaType());
  }
View Full Code Here

TOP

Related Classes of nl.siegmann.epublib.domain.Book

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.