Package org.jgrapes.io.util
Class InputStreamPipeline
java.lang.Object
org.jgrapes.io.util.InputStreamPipeline
- All Implemented Interfaces:
Runnable
Forwards the content of an input stream as a sequence of
Output
(or optionally Input
) events.The default settings and the constructor
InputStreamPipeline(InputStream, IOSubchannel)
reflect
the usage of this class for generating a response (e.g. provide
the content of a file in response to a request from a client).
Using the class with a “downstream” event pipeline, generating
Input
events is used when an input stream generates events
that should be processed as requests by the application.
-
Constructor Summary
ConstructorDescriptionInputStreamPipeline
(InputStream in, IOSubchannel channel) Creates a new pipeline that sends the data from the given input stream as events on the given channel, using the channel’s response pipeline.InputStreamPipeline
(InputStream in, IOSubchannel channel, EventPipeline eventPipeline) Creates a new pipeline that sends the data from the given input stream as events on the given channel, using the given event pipeline. -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
setEventAssociations
(Map<Object, Object> associations) Configure associations that are applied to the generated Output events, seeEvent.setAssociated(java.lang.Object, java.lang.Object)
.Suppresses the sending of a closed event when the stream is closed.
-
Constructor Details
-
InputStreamPipeline
Creates a new pipeline that sends the data from the given input stream as events on the given channel, using the given event pipeline.- Parameters:
in
- the input stream to read fromchannel
- the channel to send toeventPipeline
- the event pipeline used for firing events
-
InputStreamPipeline
Creates a new pipeline that sends the data from the given input stream as events on the given channel, using the channel’s response pipeline.- Parameters:
in
- the input stream to read fromchannel
- the channel to send to
-
-
Method Details
-
sendInputEvents
- Returns:
- the stream for easy chaining
-
suppressClosed
Suppresses the sending of a closed event when the stream is closed.- Returns:
- the stream for easy chaining
-
setEventAssociations
Configure associations that are applied to the generated Output events, seeEvent.setAssociated(java.lang.Object, java.lang.Object)
.- Parameters:
associations
- the associations to apply- Returns:
- the pipeline for easy chaining
-
run
-