Class Content


  • public class Content
    extends Object
    Representation of content in the book
    Author:
    OpenCollab
    • Constructor Detail

      • Content

        public Content​(String mediaType,
                       String href,
                       byte[] content)
        Creates new instance of Content
        Parameters:
        mediaType - the mime type
        href - the link to the content item
        content - the file byte array
      • Content

        public Content​(String href,
                       byte[] content)
        Creates new instance of Content
        Parameters:
        href - the link to the content item
        content - the file byte array
      • Content

        public Content​(String mediaType,
                       String href,
                       String id,
                       String properties,
                       byte[] content)
        Creates a new instance of Content
        Parameters:
        mediaType - the mime type
        href - the link to the content item
        id - used as the id attribute value in the OPF manifest items and the id ref in the spine
        properties - the properties attribute value in the OPF
        content - the file byte array
      • Content

        public Content​(String href,
                       String id,
                       String properties,
                       byte[] content)
        Creates a new instance of Content
        Parameters:
        href - the link to the content item
        id - used as the id attribute value in the OPF manifest items and the id ref in the spine
        properties - the properties attribute value in the OPF
        content - the file byte array
      • Content

        public Content​(String mediaType,
                       String href,
                       InputStream content)
                throws IOException
        Creates new instance of Content
        Parameters:
        mediaType - the mime type
        href - the link to the content item
        content - the file byte array
        Throws:
        IOException - if content could not be converted to byte array
      • Content

        public Content​(String href,
                       InputStream content)
                throws IOException
        Creates new instance of Content
        Parameters:
        href - the link to the content item
        content - the file byte array
        Throws:
        IOException - if content could not be converted to byte array
      • Content

        public Content​(String mediaType,
                       String href,
                       String id,
                       String properties,
                       InputStream content)
                throws IOException
        Creates a new instance of Content
        Parameters:
        mediaType - the mime type
        href - the link to the content item
        id - used as the id attribute value in the OPF manifest items and the id ref in the spine
        properties - the properties attribute value in the OPF
        content - the file byte array
        Throws:
        IOException - if content could not be converted to byte array
      • Content

        public Content​(String href,
                       String id,
                       String properties,
                       InputStream content)
                throws IOException
        Creates a new instance of Content
        Parameters:
        href - the link to the content item
        id - used as the id attribute value in the OPF manifest items and the id ref in the spine
        properties - the properties attribute value in the OPF
        content - the file byte array
        Throws:
        IOException - if content could not be converted to byte array
    • Method Detail

      • hasFallBack

        public boolean hasFallBack()
        Indicates whether a fallback content has been set
        Returns:
        the fallback flag
      • getMediaType

        public String getMediaType()
        Returns:
        the mediaType
      • setMediaType

        public void setMediaType​(String mediaType)
        Parameters:
        mediaType - the mediaType to set
      • getHref

        public String getHref()
        Returns:
        the HREF
      • setHref

        public void setHref​(String href)
        Parameters:
        href - the HREF to set
      • getId

        public String getId()
        Returns:
        the id
      • setId

        public void setId​(String id)
        Parameters:
        id - the id to set
      • getProperties

        public String getProperties()
        Returns:
        the properties
      • setProperties

        public void setProperties​(String properties)
        Parameters:
        properties - the properties to set
      • getContent

        public byte[] getContent()
        Returns:
        the content
      • setContent

        public void setContent​(byte[] content)
        Parameters:
        content - the content to set
      • isLinear

        public boolean isLinear()
        Returns:
        the linear
      • setLinear

        public void setLinear​(boolean linear)
        Parameters:
        linear - the linear to set
      • isSpine

        public boolean isSpine()
        Returns:
        the spine
      • setSpine

        public void setSpine​(boolean spine)
        Parameters:
        spine - the spine to set
      • isToc

        public boolean isToc()
        Returns:
        the TOC
      • setToc

        public void setToc​(boolean toc)
        Parameters:
        toc - the TOC to set
      • getFallBack

        public Content getFallBack()
        Returns:
        the fallBack
      • setFallBack

        public void setFallBack​(Content fallBack)
        The spine parameter will be set to false as we do not want to add the fallback content to the spine. To override default behavior call getFallBack to set spine property.
        Parameters:
        fallBack - the fallBack to set