Package org.daisy.braille.utils.pef
Class PEFBook
- java.lang.Object
-
- org.daisy.braille.utils.pef.PEFBook
-
- All Implemented Interfaces:
Serializable
public class PEFBook extends Object implements Serializable
Provides useful information about a PEF-document.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsEightDot()
Returns true if this document contains eight dot patterns, false otherwise.boolean
equals(Object obj)
Iterable<String>
getAuthors()
Gets the document authors from this document's metadata.int
getFirstPage(int volume)
Gets the first page number in the specified volume.int
getFirstPage(int volume, int section)
Gets the first page number in the specified section.String
getInputEncoding()
Gets the encoding used for this document at the time of the parsing.int
getLastPage(int volume)
Gets the last page number in the specified volume.int
getLastPage(int volume, int section)
Gets the last page number in the specified section.int
getMaxHeight()
Gets the maximum defined page height, in rows.int
getMaxWidth()
Gets the maximum defined page width, in chars.Iterable<String>
getMetadata(String key)
Gets a collection of values for a specfied metadata key.Iterable<String>
getMetadataKeys()
Gets a collection of all metadata keys in this document.int
getPages()
Gets the total number of pages in this document.int
getPageTags()
Gets the number of page tags in this document.int
getSectionsInVolume(int volume)
Gets the number of sections in the specified volume.int
getSheets()
Gets the number of sheets in this document.int
getSheets(int volume)
Gets the number of sheets in the specified volume.int
getSheets(int volume, int section)
Gets the number of sheets in the specified section.Iterable<String>
getTitle()
Gets the document titles from this document's metadata.URI
getURI()
Gets the uri for the document at the time of parsing.int
getVolumes()
Gets the number of volumes in this document.int
hashCode()
static PEFBook
load(URI uri)
Loads information about a PEF-document from the supplied URI.String
toString()
-
-
-
Method Detail
-
load
public static PEFBook load(URI uri) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException
Loads information about a PEF-document from the supplied URI.- Parameters:
uri
- the URI to a PEF-document- Returns:
- returns a PEFBook object containing the information collected from the supplied PEF-document, or null if an error occurred
- Throws:
ParserConfigurationException
- never thrownSAXException
- never thrownXPathExpressionException
- never thrownIOException
- never thrown
-
getInputEncoding
public String getInputEncoding()
Gets the encoding used for this document at the time of the parsing.- Returns:
- returns the input encoding
-
getURI
public URI getURI()
Gets the uri for the document at the time of parsing.- Returns:
- returns the uri
-
getVolumes
public int getVolumes()
Gets the number of volumes in this document.- Returns:
- returns the number of volumes
-
getSectionsInVolume
public int getSectionsInVolume(int volume)
Gets the number of sections in the specified volume.- Parameters:
volume
- the volume number, one based- Returns:
- returns the number of sections
- Throws:
IllegalArgumentException
- if the volume is less than 1 or greater thangetVolumes()
-
getPages
public int getPages()
Gets the total number of pages in this document.- Returns:
- returns the number of pages
-
getPageTags
public int getPageTags()
Gets the number of page tags in this document.- Returns:
- returns the number of page tags
-
getSheets
public int getSheets()
Gets the number of sheets in this document.- Returns:
- returns the number of sheets
-
getSheets
public int getSheets(int volume)
Gets the number of sheets in the specified volume.- Parameters:
volume
- the volume number, one based- Returns:
- returns the number of sheets in the specified volume
- Throws:
IllegalArgumentException
- if the volume is less than 1 or greater thangetVolumes()
-
getSheets
public int getSheets(int volume, int section)
Gets the number of sheets in the specified section.- Parameters:
volume
- the volume number, one basedsection
- the section number, one based- Returns:
- returns the number of sheets in the specified section
- Throws:
IllegalArgumentException
- if the volume is less than 1 or greater thangetVolumes()
or if section is less than 1 or greater thangetSectionsInVolume(int)
-
getFirstPage
public int getFirstPage(int volume)
Gets the first page number in the specified volume.- Parameters:
volume
- the volume number, one based- Returns:
- returns the first page number in the specified volume
- Throws:
IllegalArgumentException
- if the volume is less than 1 or greater thangetVolumes()
-
getFirstPage
public int getFirstPage(int volume, int section)
Gets the first page number in the specified section.- Parameters:
volume
- the volume number, one basedsection
- the section number, one based- Returns:
- returns the first page number in the specified section
- Throws:
IllegalArgumentException
- if the volume is less than 1 or greater thangetVolumes()
or if section is less than 1 or greater thangetSectionsInVolume(int)
-
getLastPage
public int getLastPage(int volume)
Gets the last page number in the specified volume.- Parameters:
volume
- the volume number, one based- Returns:
- returns the last page number in the specified volume
- Throws:
IllegalArgumentException
- if the volume is less than 1 or greater thangetVolumes()
-
getLastPage
public int getLastPage(int volume, int section)
Gets the last page number in the specified section.- Parameters:
volume
- the volume number, one basedsection
- the section number, one based- Returns:
- returns the last page number in the specified section
- Throws:
IllegalArgumentException
- if the volume is less than 1 or greater thangetVolumes()
or if section is less than 1 or greater thangetSectionsInVolume(int)
-
getMaxWidth
public int getMaxWidth()
Gets the maximum defined page width, in chars.- Returns:
- returns the maximum page width
-
getMaxHeight
public int getMaxHeight()
Gets the maximum defined page height, in rows.- Returns:
- returns the maximum page height
-
containsEightDot
public boolean containsEightDot()
Returns true if this document contains eight dot patterns, false otherwise.- Returns:
- returns true if the document contains eight dot patterns, false otherwise
-
getMetadataKeys
public Iterable<String> getMetadataKeys()
Gets a collection of all metadata keys in this document. A metadata key is a local element name in the http://purl.org/dc/elements/1.1/ namespace.- Returns:
- returns the metadata keys
-
getMetadata
public Iterable<String> getMetadata(String key)
Gets a collection of values for a specfied metadata key. A metadata key is a local element name in the http://purl.org/dc/elements/1.1/ namespace.- Parameters:
key
- the metadata to get values for- Returns:
- returns the values for the specified key
-
getTitle
public Iterable<String> getTitle()
Gets the document titles from this document's metadata. Convenience method forgetMetadata("title")
.- Returns:
- returns the document titles
-
getAuthors
public Iterable<String> getAuthors()
Gets the document authors from this document's metadata. Convenience method forgetMetadata("creator")
.- Returns:
- returns the document authors
-
-