Class Page<PageHeader extends ToHttpHeaders,​EntityHeader extends ToHttpHeaders>

  • Type Parameters:
    PageHeader - the type of the page header; in practice this will be either * SnapshotPageHeader or * FeedPageHeader
    EntityHeader - the type of the entity headers; see Entity

    public final class Page<PageHeader extends ToHttpHeaders,​EntityHeader extends ToHttpHeaders>
    extends java.lang.Object
    The Page class represents a complete feed or snapshot page, both on the producer and consumer side. This class always represents a page that is fully present in memory; it does not handle streaming.
    • Constructor Summary

      Constructors 
      Constructor Description
      Page​(PageHeader header, @NonNull java.lang.String boundary, @NonNull java.util.List<@NonNull Entity<@NonNull EntityHeader>> entities)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NonNull java.lang.String boundary()
      The boundary string for the page's multipart representation.
      @NonNull java.util.List<@NonNull Entity<@NonNull EntityHeader>> entities()
      The list of entities for this page.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      PageHeader header()
      The page's headers.
      @NonNull Body toMultipartBody()
      Return the body of this page as a multipart document.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Page

        public Page​(@NonNull
                    PageHeader header,
                    @NonNull
                    @NonNull java.lang.String boundary,
                    @NonNull
                    @NonNull java.util.List<@NonNull Entity<@NonNull EntityHeader>> entities)
    • Method Detail

      • toMultipartBody

        @NonNull
        public @NonNull Body toMultipartBody()

        Return the body of this page as a multipart document.

        This function does not allocate a buffer for the entire page body. Instead, the entities' bodies are directly reused by the returned Body to avoid having to keep entity bodies in memory twice.

        The returned body is designed to serve the page over HTTP. The returned Body's headers must also by served as part of the HTTP header for the page to be consumable.

        Returns:
        a Body containing the page's entities as a multipart document
      • header

        @NonNull
        public PageHeader header()
        The page's headers. This does not include Content-Length and Content-Type which are included in the return value of toMultipartBody().
      • boundary

        @NonNull
        public @NonNull java.lang.String boundary()
        The boundary string for the page's multipart representation.
      • entities

        @NonNull
        public @NonNull java.util.List<@NonNull Entity<@NonNull EntityHeader>> entities()
        The list of entities for this page.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object