java.lang.Object
com.atlassian.confluence.content.render.xhtml.Streamables

public class Streamables extends Object
Convenience class for common operations to construct or convert Streamable instances.
  • Constructor Details

    • Streamables

      public Streamables()
  • Method Details

    • from

      public static Streamable from(String source)
      Produce a streamable from a string. This is the least memory-efficient way to get data into a stream, but may be useful for very simple code.
      Parameters:
      source - the string that needs to be streamed
      Returns:
      the streamable version of the provided string
    • combine

      public static Streamable combine(Streamable... streamables)
      Combine a series of streamable instances into a single result.
      Parameters:
      streamables - the streamables that are to be combined.
      Returns:
      a single streamable that is the equivalent of processing each provided streamable in order
    • combine

      public static Streamable combine(Iterable<Streamable> streamables)
      Combine a series of streamable instances into a single result.
      Parameters:
      streamables - the streamables that are to be combined.
      Returns:
      a single streamable that is the equivalent of processing each provided streamable in order
    • from

      public static Streamable from(XmlStreamWriterTemplate template, XmlStreamWriterCallback callback)
      Create a streamable that will produce the result of executing the provide callback within the template. Execution of the callback may be postponed until the streamable's writeTo method is called.
      Parameters:
      template - the template in which to execute the callback
      callback - the callback to execute
      Returns:
      a streamable that will produce the result of executing the callback
    • empty

      public static Streamable empty()
      Create an empty streamable that will do nothing when its writeTo() method is called.
      Returns:
      an empty streamable
    • writeToString

      public static String writeToString(Streamable streamable)
      Write the contents of a streamable to a string. For efficiency, this should be done as little and as late as possible in the rendering pipeline.
      Parameters:
      streamable - the streamable to write
      Returns:
      a string containing the contents of the streamable.
    • withCharacterCounting

      @Deprecated public static Streamable withCharacterCounting(Streamable delegate, com.atlassian.fugue.Effect<Long> characterCountCallback)
      Deprecated.
      Produces a Streamable which counts the number of characters written to another Streamable's writer.
      Parameters:
      delegate - The streamable to be wrapped
      characterCountCallback - The callback for receiving the character count
      Returns:
      A Streamable wrapper
      Since:
      5.8
    • withCountingCharacters

      public static Streamable withCountingCharacters(Streamable delegate, Consumer<Long> characterCountCallback)
      Produces a Streamable which counts the number of characters written to another Streamable's writer.
      Parameters:
      delegate - The streamable to be wrapped
      characterCountCallback - The callback for receiving the character count
      Returns:
      A Streamable wrapper
      Since:
      7.0.1