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. Both
require an InputStream
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 defines a constructor that requires an
OutputStream
, 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”.