org.springframework.integration.adapter.file
Class SimpleFileMessageMapper
java.lang.Object
org.springframework.integration.adapter.file.SimpleFileMessageMapper
- All Implemented Interfaces:
- MessageMapper<java.lang.Object,java.io.File>
public class SimpleFileMessageMapper
- extends java.lang.Object
- implements MessageMapper<java.lang.Object,java.io.File>
A default MessageMapper
for FileTarget
, converting payloads of the
File
, byte[]
and String
types to files. The name of the newly
created file is defined by the FileNameGenerator
instance configured with it.
By default, it uses a DefaultFileNameGenerator
.
- Author:
- Marius Bogoevici
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fileNameGenerator
private volatile FileNameGenerator fileNameGenerator
parentDirectory
private final java.io.File parentDirectory
SimpleFileMessageMapper
public SimpleFileMessageMapper(java.lang.String parentDirectoryPath)
SimpleFileMessageMapper
public SimpleFileMessageMapper(java.io.File parentDirectory)
setFileNameGenerator
public void setFileNameGenerator(FileNameGenerator fileNameGenerator)
mapMessage
public java.io.File mapMessage(Message<java.lang.Object> message)
- Description copied from interface:
MessageMapper
- Map from the given
Message
to an Object.
- Specified by:
mapMessage
in interface MessageMapper<java.lang.Object,java.io.File>
writeToFile
public void writeToFile(java.io.File file,
java.lang.Object payload)
throws java.io.IOException
- Throws:
java.io.IOException