public interface

MarkupOutput

com.microstrategy.web.beans.MarkupOutput
Known Indirect Subclasses

Class Overview

This object is used by a transform to record the results of a transformation. This object can be in two modes: text or binary. In text mode, all elements inside this object are of String type. In binary mode, all elements inside this object are of byte [] type. User can use the getBianryMode() method to check the mode. Before this object has any data, it will be in neither mode. But after the first element is added into the collection, its mode has been fixed. After the mode has been fixed, if user adds other type of data into this collection, or asks for the other type representation of this object, an IllegalStateException will be thrown. Inside this object, when it is in the text mode, we will keep the data into an array of StringBuffer. When user calls getTextChunkAt(i), the content of the ith StringBuffer in the array will be returned. User can control the StringBuffer's initial and maximum size by putting a properties file name 'MarkupOutput.properties" in the classpath. In this file, user should specify two properties: initBufferSize and maxBufferSize, which is in unit of character.

Summary

Public Methods
abstract void addBlock(Block block)
Adds a "root-level" Block to this MarkupOutput instance.
abstract void addErrorInfo(String error)
Append more error information to the MarkupOutput.
abstract void addHeader(String key, String value)
Adds a header with the specified key value pair.
abstract void append(byte[] element)
Adds data at the end of the MarkupOutput object.
abstract void append(MarkupOutput element)
Adds data at the end of the MarkupOutput object.
abstract void append(ComponentBlock child)
Append a ComponentBlock object to the MarkupOutput if the "primary" ComponentBlock is set it will be appended as its children otherwise it will be appended to a list field and then gets appended to a ComponentBlock later
abstract void append(String element)
Adds data at the end of the MarkupOutput object.
abstract void append(Object element)
Adds data at the end of the MarkupOutput object.
abstract void append(MarkupOutput element, boolean encode)
Adds data at the end of the EncodedMarkupOutput object.
abstract void appendHtml(String element)
Adds encoded HTML data at the end of the MarkupOutput object.
abstract void appendJS(String element)
Adds encoded JSON data at the end of the MarkupOutput object.
abstract int chunkCount()
Returns the number of chunks contained in the MarkupOutput object.
abstract byte[] getBinaryChunkAt(int i)
Returns the byte array chunk at the specified index.
abstract byte[] getBinaryContent()
Get all of the binary data in the MarkupOutput at once.
abstract boolean getBinaryMode()
Returns whether the output is set to collate binary or text data.
abstract Block getBlock(int index)
Returns the ith "root level" Block associated with this MarkupOutput object.
abstract BlockContext getBlockContext()
Returns the current "block context" object which is used for BlockProperty value expansion and overall Block serialization.
abstract int getBlockCount()
Returns the number of "root level" Blocks populated by a transform or layout file and associated with this MarkupOutput instance.
abstract List<ComponentBlock> getChildBlocks()
Gets the list of child ComponentBlocks
abstract ComponentBlock getComponentBlock()
Returns the "primpary" ComponentBlock this MarkupOutput instance holds
abstract int getContentLength()
Returns the length of the content.
abstract String getContentType()
Returns the content-type associated with this output.
abstract String getCopyAsString()
Returns the content of this object in the String format.
abstract StringBuffer getErrorInfo()
Returns the error information that is held by this MarkupOutput instance.
abstract int getHeaderCount()
Returns the header count.
abstract String getHeaderKey(int i)
Returns the header key at the specified index.
abstract String getHeaderValue(String key)
Returns the header value for the given header key.
abstract String getTextChunkAt(int i)
Returns the String chunk at the specified index.
abstract Object getUnserializedObject()
Gets the UnserializedObject member which is used to contain the actual unprocessed output object.
abstract boolean hasChildBlocks()
Returns a flag indicating whether the child ComponentBlocks list is empty or not
abstract boolean hasComponentBlock()
Returns a flag indicating whether the "primary" ComponentBlock is set or not
abstract boolean hasErrorInfo()
Returns the flag which indicates whether this MarkupOutput instance has with error information recorded or not
abstract void send(OutputStream outStream)
The results are sent back to the user via the supplied OutputStream object.
abstract void send(Writer writer)
The results are sent back to the user via the implicit out object.
abstract void setBinaryContent(byte[] bytes)
Replaces the existing binary content with a new byte array.
abstract void setBlockContext(BlockContext blockContext)
Sets the current "block context" object which is used for BlockProperty value expansion and overall Block serialization.
abstract void setComponentBlock(ComponentBlock cb)
Sets the "primary" ComponentBlock on the MarkupOutput instance once it's set all the other ComponentBlock will be appended as its children
abstract void setContentType(String contentType)
Sets the Content-Type associated with this output.
abstract void setErrorInfo(StringBuffer error)
Set error information onto the MarkupOutput.
abstract void setUnserializedObject(Object unserializedObject)
Sets the UnserializedObject member which is used to contain the actual unprocessed output object.

Public Methods

public abstract void addBlock (Block block)

Adds a "root-level" Block to this MarkupOutput instance. The fully populated Block can then be retrieved by the caller and integrated into a larger Block hierarchy.

Parameters
block The Block instance to add to this MarkupOutput object. Note that only "top-level" Blocks should be added. Nested Blocks need not be associated with this MarkupOutput instance.

public abstract void addErrorInfo (String error)

Append more error information to the MarkupOutput. If componentBlock is set the error will be get appended there otherwise this MarkupOutput instance will host the info.

Parameters
error the error information that needs to be added

public abstract void addHeader (String key, String value)

Adds a header with the specified key value pair.

Parameters
key header key name.
value header value.

public abstract void append (byte[] element)

Adds data at the end of the MarkupOutput object.

Parameters
element the byte array wanted to be appended to the collection.
Throws
IllegalArgumentException thrown if the element is null.
IllegalStateException thrown if current MarkupOutput is at text mode.

public abstract void append (MarkupOutput element)

Adds data at the end of the MarkupOutput object. NOTE: The current content in the input parameter will be added into this MarkupOutput immediately. Future changes to the input parameter element will not be reflected in this MarkupOutput.

Parameters
element the object wanted to be appended to the collection.
Throws
IllegalArgumentException thrown if the element is null.
IllegalStateException thrown if the mode of the current MarkupOutput is not compatible with the mode of the input MarkupOutput.

public abstract void append (ComponentBlock child)

Append a ComponentBlock object to the MarkupOutput if the "primary" ComponentBlock is set it will be appended as its children otherwise it will be appended to a list field and then gets appended to a ComponentBlock later

Parameters
child the ComponentBlock that needs to be appended

public abstract void append (String element)

Adds data at the end of the MarkupOutput object.

Parameters
element the String wanted to be appended to the collection.
Throws
IllegalArgumentException thrown if the element is null.
IllegalStateException thrown if current MarkupOutput is at binary mode.

public abstract void append (Object element)

Adds data at the end of the MarkupOutput object.

Parameters
element the object wanted to be appended to the collection.
Throws
IllegalArgumentException thrown if the element is null.
IllegalStateException thrown if current MarkupOutput is at binary mode.

public abstract void append (MarkupOutput element, boolean encode)

Adds data at the end of the EncodedMarkupOutput object.

Parameters
element the String wanted to be appended to the collection.
encode the Boolean indicating whether encode is needed or not upon appending.
Throws
IllegalArgumentException thrown if the element is null.
IllegalStateException thrown if current MarkupOutput is at binary mode.

public abstract void appendHtml (String element)

Adds encoded HTML data at the end of the MarkupOutput object.

Parameters
element the String to be encoded and appended to the collection.
Throws
IllegalArgumentException thrown if the element is null.
IllegalStateException thrown if current MarkupOutput is in binary mode.

public abstract void appendJS (String element)

Adds encoded JSON data at the end of the MarkupOutput object.

Parameters
element the String to be encoded and appended to the collection.
Throws
IllegalArgumentException thrown if the element is null.
IllegalStateException thrown if current MarkupOutput is in binary mode.

public abstract int chunkCount ()

Returns the number of chunks contained in the MarkupOutput object.

Returns
  • number of elements in the MarkupOutput object.

public abstract byte[] getBinaryChunkAt (int i)

Returns the byte array chunk at the specified index.

Parameters
i the index of the element in the collection.
Returns
  • The byte array at the specified index.
Throws
IndexOutOfBoundsException thrown if no item in the collection has the given index.
IllegalStateException thrown if current MarkupOutput is at text mode

public abstract byte[] getBinaryContent ()

Get all of the binary data in the MarkupOutput at once.

Returns
  • A single byte array that contains all binary content. If there is no binary data, null is returned.
Throws
IllegalStateException If current MarkupOutput is in "text mode"

public abstract boolean getBinaryMode ()

Returns whether the output is set to collate binary or text data. This is determined by inspecting the content of the first append operation. If no data has been appended, it will return false (i.e. text mode) by default.

Returns
  • true=binary, false=text mode.

public abstract Block getBlock (int index)

Returns the ith "root level" Block associated with this MarkupOutput object.

Parameters
index The index of the Block to return.
Returns
  • The ith Block in this list.

public abstract BlockContext getBlockContext ()

Returns the current "block context" object which is used for BlockProperty value expansion and overall Block serialization.

Returns
  • The BlockContext to use when converting a Block into a serialized form in the MarkupOutput.

public abstract int getBlockCount ()

Returns the number of "root level" Blocks populated by a transform or layout file and associated with this MarkupOutput instance.

Returns
  • The number of Block objects associated with this markup output.

public abstract List<ComponentBlock> getChildBlocks ()

Gets the list of child ComponentBlocks

Returns
  • List the block list

public abstract ComponentBlock getComponentBlock ()

Returns the "primpary" ComponentBlock this MarkupOutput instance holds

Returns
  • the ComponentBlock instance

public abstract int getContentLength ()

Returns the length of the content.

Returns
  • The length of the content (the number of bytes if it's binary, or the number of characters if it's not).

public abstract String getContentType ()

Returns the content-type associated with this output.

Returns
  • the content type

public abstract String getCopyAsString ()

Returns the content of this object in the String format.

Returns
  • a String representing the current content.

public abstract StringBuffer getErrorInfo ()

Returns the error information that is held by this MarkupOutput instance.

Returns
  • StringBuffer the StringBuffer that holds the error information

public abstract int getHeaderCount ()

Returns the header count.

Returns
  • the header count.

public abstract String getHeaderKey (int i)

Returns the header key at the specified index.

Parameters
i index.
Returns
  • the header key.

public abstract String getHeaderValue (String key)

Returns the header value for the given header key.

Parameters
key header key.
Returns
  • header value.

public abstract String getTextChunkAt (int i)

Returns the String chunk at the specified index.

Parameters
i the index of the element in the collection.
Returns
  • string chunk at the specified index.
Throws
IndexOutOfBoundsException thrown if no chunk in the collection has the given index.
IllegalStateException thrown if current MarkupOutput is at binary mode

public abstract Object getUnserializedObject ()

Gets the UnserializedObject member which is used to contain the actual unprocessed output object.

public abstract boolean hasChildBlocks ()

Returns a flag indicating whether the child ComponentBlocks list is empty or not

Returns
  • boolean true if it contains child ComponentBlocks false otherwise

public abstract boolean hasComponentBlock ()

Returns a flag indicating whether the "primary" ComponentBlock is set or not

Returns
  • boolean true if set false if not

public abstract boolean hasErrorInfo ()

Returns the flag which indicates whether this MarkupOutput instance has with error information recorded or not

Returns
  • boolean true if it contains error information false otherwise

public abstract void send (OutputStream outStream)

The results are sent back to the user via the supplied OutputStream object.

Parameters
outStream the binary output stream object.
Throws
IllegalStateException thrown if current mode is text.
IOException

public abstract void send (Writer writer)

The results are sent back to the user via the implicit out object.

Parameters
writer the implicit out object.
Throws
IllegalStateException thrown if the current mode is binary.
IOException thrown in case an error occurs while writing to the output.

public abstract void setBinaryContent (byte[] bytes)

Replaces the existing binary content with a new byte array. The previous byte data is dropped.

Parameters
bytes The new byte array to be associated with this MarkupOutput.
Throws
IllegalStateException If current MarkupOutput is in "text mode"

public abstract void setBlockContext (BlockContext blockContext)

Sets the current "block context" object which is used for BlockProperty value expansion and overall Block serialization.

Parameters
blockContext The BlockContext to use when converting a Block into a serialized form in the MarkupOutput.

public abstract void setComponentBlock (ComponentBlock cb)

Sets the "primary" ComponentBlock on the MarkupOutput instance once it's set all the other ComponentBlock will be appended as its children

Parameters
cb the ComponentBlock to be set

public abstract void setContentType (String contentType)

Sets the Content-Type associated with this output.

Parameters
contentType the content type.

public abstract void setErrorInfo (StringBuffer error)

Set error information onto the MarkupOutput. If componentBlock is set the error will be set there otherwise this MarkupOutput instance will host the error info.

Parameters
error the StringBuffer with error information that needs to be set

public abstract void setUnserializedObject (Object unserializedObject)

Sets the UnserializedObject member which is used to contain the actual unprocessed output object.