public class CharacterStreamReadingMessageSource
extends org.springframework.integration.endpoint.AbstractMessageSource<java.lang.String>
implements org.springframework.context.ApplicationEventPublisherAware
Readers.| Constructor and Description |
|---|
CharacterStreamReadingMessageSource(java.io.Reader reader)
Construct an instance with the provider reader.
|
CharacterStreamReadingMessageSource(java.io.Reader reader,
int bufferSize)
Construct an instance with the provider reader and buffer size.
|
CharacterStreamReadingMessageSource(java.io.Reader reader,
int bufferSize,
boolean blockToDetectEOF)
Construct an instance with the provided reader and buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
doReceive() |
java.lang.String |
getComponentType() |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
static CharacterStreamReadingMessageSource |
stdin()
Create a source that reads from
System.in. |
static CharacterStreamReadingMessageSource |
stdin(java.lang.String charsetName)
Create a source that reads from
System.in. |
static CharacterStreamReadingMessageSource |
stdinPipe()
Create a source that reads from
System.in. |
static CharacterStreamReadingMessageSource |
stdinPipe(java.lang.String charsetName)
Create a source that reads from
System.in. |
buildMessage, getComponentName, getManagedName, getManagedType, getMessageCount, getMessageCountLong, getOverrides, isCountsEnabled, isLoggingEnabled, receive, registerMetricsCaptor, reset, setBeanName, setCountsEnabled, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedTypeafterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, onInit, setBeanFactory, setConversionServicepublic CharacterStreamReadingMessageSource(java.io.Reader reader)
AbstractMessageSource.receive() will return null when the reader is not ready.reader - the reader.public CharacterStreamReadingMessageSource(java.io.Reader reader,
int bufferSize)
AbstractMessageSource.receive() will return null when the reader is not ready.reader - the reader.bufferSize - the buffer size.public CharacterStreamReadingMessageSource(java.io.Reader reader,
int bufferSize,
boolean blockToDetectEOF)
blockToDetectEOF is false,
AbstractMessageSource.receive() will return null when the reader is not ready.
When it is true, the thread will block until data is available; when the
underlying stream is closed, a StreamClosedEvent is published to inform
the application via an ApplicationListener.
This can be useful, for example, when piping stdin
cat foo.txt | java -jar my.jar
or
java -jar my.jar < foo.txt
reader - the reader.bufferSize - the buffer size; if negative use the default in
BufferedReader.blockToDetectEOF - true to block the thread until data is available and
publish a StreamClosedEvent at EOF.public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic java.lang.String getComponentType()
getComponentType in interface org.springframework.integration.support.context.NamedComponentpublic java.lang.String doReceive()
doReceive in class org.springframework.integration.endpoint.AbstractMessageSource<java.lang.String>public static final CharacterStreamReadingMessageSource stdin()
System.in. EOF will not be detected.public static final CharacterStreamReadingMessageSource stdin(java.lang.String charsetName)
System.in. EOF will not be detected.charsetName - the charset to use when converting bytes to String.public static final CharacterStreamReadingMessageSource stdinPipe()
System.in. EOF will be detected and the application
context closed.CharacterStreamReadingMessageSource(Reader, int, boolean)public static final CharacterStreamReadingMessageSource stdinPipe(java.lang.String charsetName)
System.in. EOF will be detected and the application
context closed.charsetName - the charset to use when converting bytes to String.CharacterStreamReadingMessageSource(Reader, int, boolean)