Package org.daisy.braille.pef
Class PEFBook
- java.lang.Object
-
- org.daisy.braille.pef.PEFBook
-
- All Implemented Interfaces:
java.io.Serializable
public class PEFBook extends java.lang.Object implements java.io.Serializable
Provides useful information about a PEF-document.- Author:
- Joel HÃ¥kansson
- 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 otherwiseboolean
equals(java.lang.Object obj)
java.lang.Iterable<java.lang.String>
getAuthors()
Gets the document authors from this document's metadata.int
getFirstPage(int volume)
Gets the first page number in the specified volumejava.lang.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 volumeint
getMaxHeight()
Gets the maximum defined page height, in rowsint
getMaxWidth()
Gets the maximum defined page width, in charsjava.lang.Iterable<java.lang.String>
getMetadata(java.lang.String key)
Gets a collection of values for a specfied metadata key.java.lang.Iterable<java.lang.String>
getMetadataKeys()
Gets a collection of all metadata keys in this document.int
getPages()
Gets the total number of pages in this documentint
getPageTags()
Gets the number of page tags in this document.int
getSheets()
Gets the number of sheets in this document.int
getSheets(int volume)
Gets the number of sheets in the specified volumejava.lang.Iterable<java.lang.String>
getTitle()
Gets the document title from this document's metadata.int
getVolumes()
Gets the number of volumes in this document.int
hashCode()
static PEFBook
load(java.net.URI uri)
Loads information about a PEF-document from the supplied uri.java.lang.String
toString()
-
-
-
Method Detail
-
load
public static PEFBook load(java.net.URI uri) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, javax.xml.xpath.XPathExpressionException, java.io.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
- Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
javax.xml.xpath.XPathExpressionException
java.io.IOException
-
getInputEncoding
public java.lang.String getInputEncoding()
Gets the encoding used for this document at the time of the parsing.
-
getVolumes
public int getVolumes()
Gets the number of volumes in this document.
-
getPages
public int getPages()
Gets the total number of pages in this document
-
getPageTags
public int getPageTags()
Gets the number of page tags in this document.
-
getSheets
public int getSheets()
Gets the number of sheets in this document.
-
getSheets
public int getSheets(int volume)
Gets the number of sheets in the specified volume- Parameters:
volume
- the desired volume, where the first volume is 1 and the last equals getVolumes- Returns:
- returns the number of sheets in the specified volume
- Throws:
java.lang.IllegalArgumentException
- if the volume is less than 1 or greater than getVolumes
-
getFirstPage
public int getFirstPage(int volume)
Gets the first page number in the specified volume- Parameters:
volume
- the desired volume, where the first volume is 1 and the last equals getVolumes.- Returns:
- returns the first page number in the specified volume
- Throws:
java.lang.IllegalArgumentException
- if the volume is less than 1 or greater than getVolumes
-
getLastPage
public int getLastPage(int volume)
Gets the last page number in the specified volume- Parameters:
volume
- the desired volume (the first volume is 1 and the last is getVolumes)- Returns:
- returns the last page number in the specified volume
- Throws:
java.lang.IllegalArgumentException
- if the volume is less than 1 or greater than getVolumes
-
getMaxWidth
public int getMaxWidth()
Gets the maximum defined page width, in chars
-
getMaxHeight
public int getMaxHeight()
Gets the maximum defined page height, in rows
-
containsEightDot
public boolean containsEightDot()
Returns true if this document contains eight dot patterns, false otherwise
-
getMetadataKeys
public java.lang.Iterable<java.lang.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.
-
getMetadata
public java.lang.Iterable<java.lang.String> getMetadata(java.lang.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
-
getTitle
public java.lang.Iterable<java.lang.String> getTitle()
Gets the document title from this document's metadata. Convenience method for getMetadata("title")
-
getAuthors
public java.lang.Iterable<java.lang.String> getAuthors()
Gets the document authors from this document's metadata. Convenience method for getMetadata("creator")
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-