Class StreamTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.transformer.StreamTransformer
- 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.context.ApplicationContextAware,ExpressionCapable,NamedComponent,GenericTransformer<org.springframework.messaging.Message<?>,org.springframework.messaging.Message<?>>,Transformer
public class StreamTransformer extends AbstractTransformer
Transforms an InputStream payload to a byte[] or String (if a
charset is provided).
- Since:
- 4.3
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Constructor Summary
Constructors Constructor Description StreamTransformer()Construct an instance to transform anInputStreamto abyte[].StreamTransformer(java.lang.String charset)Construct an instance with the charset to convert the stream to a String; if null abyte[]will be produced instead. -
Method Summary
Modifier and Type Method Description protected java.lang.ObjectdoTransform(org.springframework.messaging.Message<?> message)Subclasses must implement this method to provide the transformation logic.Methods inherited from class org.springframework.integration.transformer.AbstractTransformer
transformMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Constructor Details
-
StreamTransformer
public StreamTransformer()Construct an instance to transform anInputStreamto abyte[]. -
StreamTransformer
public StreamTransformer(java.lang.String charset)Construct an instance with the charset to convert the stream to a String; if null abyte[]will be produced instead.- Parameters:
charset- the charset.
-
-
Method Details
-
doTransform
protected java.lang.Object doTransform(org.springframework.messaging.Message<?> message)Description copied from class:AbstractTransformerSubclasses must implement this method to provide the transformation logic. If the return value is itself a Message, it will be used as the result. Otherwise, any non-null return value will be used as the payload of the result Message.- Specified by:
doTransformin classAbstractTransformer- Parameters:
message- The message.- Returns:
- The result of the transformation.
-