com.atlassian.confluence.content.render.xhtml
Class Streamables

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

public class Streamables
extends Object

Convenience class for common operations to construct or convert Streamable instances.


Constructor Summary
Streamables()
           
 
Method Summary
static Streamable combine(Iterable<Streamable> streamables)
          Combine a series of streamable instances into a single result.
static Streamable combine(Streamable... streamables)
          Combine a series of streamable instances into a single result.
static Streamable empty()
          Create an empty streamable that will do nothing when its writeTo() method is called.
static Streamable from(String source)
          Produce a streamable from a string.
static Streamable from(XmlStreamWriterTemplate template, XmlStreamWriterCallback callback)
          Create a streamable that will produce the result of executing the provide callback within the template.
static String writeToString(Streamable streamable)
          Write the contents of a streamable to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Streamables

public Streamables()
Method Detail

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.


Copyright © 2003–2015 Atlassian. All rights reserved.