Spring Integration also provides adapters for streams. Both ByteStreamSourceAdapter
and
CharacterStreamSourceAdapter
extend the PolllingSourceAdapter
so
that the polling period can be configured, and the Message Bus can automatically detect and schedule them. The
byte stream version requires an InputStream
, and the character stream version requires a
Reader
as the single constructor argument. The
ByteStreamSourceAdapter
also accepts the 'bytesPerMessage' property to determine how many
bytes it will attempt to read into each Message
.
For target streams, there are also two implementations: ByteStreamTargetAdapter
and
CharacterStreamTargetAdapter
. Each requires a single constructor argument -
OutputStream
for byte streams or Writer
for character streams,
and each provides a second constructor that adds the optional 'bufferSize' property. Since both of these
ultimately implement the MessageHandler
interface, they can be referenced from an
endpoint configuration as will be described in more detail in the section called “Configuring Message Endpoints”.