public class CharacterStreamWritingMessageHandler extends AbstractMessageHandler
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.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
CharacterStreamWritingMessageHandler(Writer writer) |
CharacterStreamWritingMessageHandler(Writer writer,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
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(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(String charsetName)
Factory method that creates a target for stdout (System.out) with the
specified charset encoding.
|
getOrder, handleMessage, setOrder, setShouldTrack
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, onInit, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
public CharacterStreamWritingMessageHandler(Writer writer)
public CharacterStreamWritingMessageHandler(Writer writer, int bufferSize)
public static CharacterStreamWritingMessageHandler stdout()
public static CharacterStreamWritingMessageHandler stdout(String charsetName)
charsetName
- The charset name.public static CharacterStreamWritingMessageHandler stderr()
public static CharacterStreamWritingMessageHandler stderr(String charsetName)
charsetName
- The charset name.public void setShouldAppendNewLine(boolean shouldAppendNewLine)
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageHandler
protected void handleMessageInternal(Message<?> message)
handleMessageInternal
in class AbstractMessageHandler