Spring Integration

org.springframework.integration.stream
Class CharacterStreamWritingMessageHandler

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.handler.AbstractMessageHandler
          extended by org.springframework.integration.stream.CharacterStreamWritingMessageHandler
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, NamedComponent, Orderable, MessageHandler, TrackableComponent

public class CharacterStreamWritingMessageHandler
extends AbstractMessageHandler

A MessageHandler that writes characters to a Writer. String, character array, and byte array payloads will be written directly, but for other payload types, the result of the object's IntegrationObjectSupport.toString() method will be written. To append a new-line after each write, set the shouldAppendNewLine flag to 'true'. It is 'false' by default.

Author:
Mark Fisher

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
CharacterStreamWritingMessageHandler(java.io.Writer writer)
           
CharacterStreamWritingMessageHandler(java.io.Writer writer, int bufferSize)
           
 
Method Summary
protected  void handleMessageInternal(Message<?> message)
           
 void setShouldAppendNewLine(boolean shouldAppendNewLine)
           
static CharacterStreamWritingMessageHandler stderr()
          Factory method that creates a target for stderr (System.err) with the default charset encoding.
static CharacterStreamWritingMessageHandler stderr(java.lang.String charsetName)
          Factory method that creates a target for stderr (System.err) with the specified charset encoding.
static CharacterStreamWritingMessageHandler stdout()
          Factory method that creates a target for stdout (System.out) with the default charset encoding.
static CharacterStreamWritingMessageHandler stdout(java.lang.String charsetName)
          Factory method that creates a target for stdout (System.out) with the specified charset encoding.
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getComponentType, getOrder, handleMessage, setOrder, setShouldTrack
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName
 

Constructor Detail

CharacterStreamWritingMessageHandler

public CharacterStreamWritingMessageHandler(java.io.Writer writer)

CharacterStreamWritingMessageHandler

public CharacterStreamWritingMessageHandler(java.io.Writer writer,
                                            int bufferSize)
Method Detail

stdout

public static CharacterStreamWritingMessageHandler stdout()
Factory method that creates a target for stdout (System.out) with the default charset encoding.


stdout

public static CharacterStreamWritingMessageHandler stdout(java.lang.String charsetName)
Factory method that creates a target for stdout (System.out) with the specified charset encoding.


stderr

public static CharacterStreamWritingMessageHandler stderr()
Factory method that creates a target for stderr (System.err) with the default charset encoding.


stderr

public static CharacterStreamWritingMessageHandler stderr(java.lang.String charsetName)
Factory method that creates a target for stderr (System.err) with the specified charset encoding.


setShouldAppendNewLine

public void setShouldAppendNewLine(boolean shouldAppendNewLine)

handleMessageInternal

protected void handleMessageInternal(Message<?> message)
Specified by:
handleMessageInternal in class AbstractMessageHandler

Spring Integration