Package 

Class Streamer

  • All Implemented Interfaces:

    
    public final class Streamer
    
                        

    Opens a Publication using a list of parsers.

    The Streamer is configured to use Readium's default parsers, which you can bypass using ignoreDefaultParsers. However, you can provide additional parsers which will take precedence over the default ones. This can also be used to provide an alternative configuration of a default parser.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Streamer(Context context, List<PublicationParser> parsers, Boolean ignoreDefaultParsers, List<ContentProtection> contentProtections, ArchiveFactory archiveFactory, PdfDocumentFactory<?> pdfFactory, DefaultHttpClient httpClient, Function1<Publication.Builder, Unit> onCreatePublication)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Try<Publication, Publication.OpeningException> open(PublicationAsset asset, String credentials, Boolean allowUserInteraction, Object sender, Function1<Publication.Builder, Unit> onCreatePublication, WarningLogger warnings) Parses a Publication from the given asset.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Streamer

        Streamer(Context context, List<PublicationParser> parsers, Boolean ignoreDefaultParsers, List<ContentProtection> contentProtections, ArchiveFactory archiveFactory, PdfDocumentFactory<?> pdfFactory, DefaultHttpClient httpClient, Function1<Publication.Builder, Unit> onCreatePublication)
        Parameters:
        context - Application context.
        parsers - Parsers used to open a publication, in addition to the default parsers.
        ignoreDefaultParsers - When true, only parsers provided in parsers will be used.
        archiveFactory - Opens an archive (e.g.
        pdfFactory - Parses a PDF document, optionally protected by password.
        httpClient - Service performing HTTP requests.
        onCreatePublication - Called on every parsed Publication.Builder.
    • Method Detail

      • open

         final Try<Publication, Publication.OpeningException> open(PublicationAsset asset, String credentials, Boolean allowUserInteraction, Object sender, Function1<Publication.Builder, Unit> onCreatePublication, WarningLogger warnings)

        Parses a Publication from the given asset.

        If you are opening the publication to render it in a Navigator, you must set allowUserInteraction to true to prompt the user for its credentials when the publication is protected. However, set it to false if you just want to import the Publication without reading its content, to avoid prompting the user.

        When using Content Protections, you can use sender to provide a free object which can be used to give some context. For example, it could be the source Activity or Fragment which would be used to present a credentials dialog.

        The warnings logger can be used to observe non-fatal parsing warnings, caused by publication authoring mistakes. This can be useful to warn users of potential rendering issues.

        Parameters:
        asset - Digital medium (e.g.
        credentials - Credentials that Content Protections can use to attempt to unlock a publication, for example a password.
        allowUserInteraction - Indicates whether the user can be prompted, for example for its credentials.
        sender - Free object that can be used by reading apps to give some UX context when presenting dialogs.
        onCreatePublication - Transformation which will be applied on the Publication Builder.
        warnings - Logger used to broadcast non-fatal parsing warnings.