Package nl.siegmann.epublib.domain
Class Book
java.lang.Object
nl.siegmann.epublib.domain.Book
- All Implemented Interfaces:
Serializable
Representation of a Book.
All resources of a Book (html, css, xml, fonts, images) are represented as Resources. See getResources() for access to these.
A Book as 3 indexes into these Resources, as per the epub specification.
invalid input: '<'rdf:RDF>
invalid input: '<'cc:Work rdf:about="">
invalid input: '<'dc:format>image/svg+xmlinvalid input: '<'/dc:format>
invalid input: '<'dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
invalid input: '<'dc:title/>
invalid input: '<'/cc:Work>
invalid input: '<'/rdf:RDF>
invalid input: '<'text id="text4507" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="40px" font-style="normal" y="122.36219" x="88.571434" font-family="Sans" line-height="125%" fill="#000000">Spine
invalid input: '<'text id="text4507-3" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="40px" font-style="normal" y="142.38702" x="262.85712" font-family="Sans" line-height="125%" fill="#000000">Table of Contents
invalid input: '<'text id="text4507-5" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="40px" font-style="normal" y="208.1013" x="581.42853" font-family="Sans" line-height="125%" fill="#000000">Guide
invalid input: '<'text id="text4577" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="188.89537" x="92.349854" font-family="Sans" line-height="125%" fill="#000000">Chapter 1
invalid input: '<'text id="text4577-0" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="255.01701" x="92.76873" font-family="Sans" line-height="125%" fill="#000000">Chapter 1
invalid input: '<'text id="text4577-0-3" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="278.23132" x="108.66158" font-family="Sans" line-height="125%" fill="#000000">Part 2
invalid input: '<'text id="text4577-0-6" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="327.33847" x="90.983017" font-family="Sans" line-height="125%" fill="#000000">Chapter 2
invalid input: '<'text id="text4577-6" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="215.1956" x="351.34015" font-family="Sans" line-height="125%" fill="#000000">Chapter 1
invalid input: '<'text id="text4577-0-6-1" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="276.62418" x="351.36185" font-family="Sans" line-height="125%" fill="#000000">Chapter 2
invalid input: '<'text id="text4577-6-5" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="278.05276" x="598.48297" font-family="Sans" line-height="125%" fill="#000000">Cover
invalid input: '<'text id="text4507-1" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="40px" font-style="normal" y="418.66241" x="238.73047" font-family="Sans" line-height="125%" fill="#000000">Resources
invalid input: '<'text id="text4577-6-5-4" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" xml:space="preserve" font-size="21.50233269px" font-style="normal" y="351.48663" x="594.909" font-family="Sans" line-height="125%" fill="#000000">Preface
A Book as 3 indexes into these Resources, as per the epub specification.
- Spine
- these are the Resources to be shown when a user reads the book from start to finish.
- Table of Contents
- The table of contents. Table of Contents references may be in a different order and contain different Resources than the spine, and often do.
- Guide
- The Guide has references to a set of special Resources like the cover page, the Glossary, the copyright page, etc.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddResource(Resource resource) addSection(String title, Resource resource) Adds a resource to the book's set of resources, table of contents and if there is no resource with the id in the spine also adds it to the spine.addSection(TOCReference parentSection, String sectionTitle, Resource resource) Adds the resource to the table of contents of the book as a child section of the given parentSectionprivate static voidaddToContentsResult(Resource resource, Map<String, Resource> allReachableResources) voidAll Resources of the Book that can be reached via the Spine, the TableOfContents or the Guide.The book's cover image.The book's cover page as a Resource.getGuide()The guide; contains references to special sections of the book like colophon, glossary, etc.The Book's metadata (titles, authors, etc)The collection of all images, chapters, sections, xhtml files, stylesheets, etc that make up the book.getSpine()The sections of the book that should be shown if a user reads the book from start to finish.The Table of Contents of the book.getTitle()Gets the first non-blank title from the book's metadata.voidsetCoverImage(Resource coverImage) voidsetCoverPage(Resource coverPage) voidsetMetadata(Metadata metadata) voidsetNcxResource(Resource ncxResource) voidsetOpfResource(Resource opfResource) voidsetResources(Resources resources) voidvoidsetTableOfContents(TableOfContents tableOfContents)
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
resources
-
metadata
-
spine
-
tableOfContents
-
guide
-
opfResource
-
ncxResource
-
coverImage
-
-
Constructor Details
-
Book
public Book()
-
-
Method Details
-
addSection
Adds the resource to the table of contents of the book as a child section of the given parentSection- Parameters:
parentSection-sectionTitle-resource-- Returns:
- The table of contents
-
generateSpineFromTableOfContents
public void generateSpineFromTableOfContents() -
addSection
Adds a resource to the book's set of resources, table of contents and if there is no resource with the id in the spine also adds it to the spine.- Parameters:
title-resource-- Returns:
- The table of contents
-
getMetadata
The Book's metadata (titles, authors, etc)- Returns:
- The Book's metadata (titles, authors, etc)
-
setMetadata
-
setResources
-
addResource
-
getResources
The collection of all images, chapters, sections, xhtml files, stylesheets, etc that make up the book.- Returns:
- The collection of all images, chapters, sections, xhtml files, stylesheets, etc that make up the book.
-
getSpine
The sections of the book that should be shown if a user reads the book from start to finish.- Returns:
- The Spine
-
setSpine
-
getTableOfContents
The Table of Contents of the book.- Returns:
- The Table of Contents of the book.
-
setTableOfContents
-
getCoverPage
The book's cover page as a Resource. An XHTML document containing a link to the cover image.- Returns:
- The book's cover page as a Resource
-
setCoverPage
-
getTitle
Gets the first non-blank title from the book's metadata.- Returns:
- the first non-blank title from the book's metadata.
-
getCoverImage
The book's cover image.- Returns:
- The book's cover image.
-
setCoverImage
-
getGuide
The guide; contains references to special sections of the book like colophon, glossary, etc.- Returns:
- The guide; contains references to special sections of the book like colophon, glossary, etc.
-
getContents
All Resources of the Book that can be reached via the Spine, the TableOfContents or the Guide. Consists of a list of "reachable" resources:- The coverpage
- The resources of the Spine that are not already in the result
- The resources of the Table of Contents that are not already in the result
- The resources of the Guide that are not already in the result
getResources()- Returns:
- All Resources of the Book that can be reached via the Spine, the TableOfContents or the Guide.
-
addToContentsResult
-
getOpfResource
-
setOpfResource
-
setNcxResource
-
getNcxResource
-