1919import java .util .function .BiConsumer ;
2020
2121/**
22- * A collection of all the 3 main pipes used in stdio: STDIN, STDOUT and STDERR. As working with the named pipes is usually carried out
23- * asynchronously, this collection also provides means to initiate and handle the close() event. A close() initiator calls the
24- * {@link #close(int, long)} method expressing its intent to close the communication channel. Handlers are notified of this intent and
25- * its up to the handlers to decide what's to be done next. Calling {@link #close(int, long)} does not close the streams or do anything
26- * else besides notifying the handlers.
22+ * A collection of all the 3 main pipes used in stdio: STDIN, STDOUT and STDERR. As working with the
23+ * named pipes is usually carried out asynchronously, this collection also provides means to
24+ * initiate and handle the close() event. A close() initiator calls the {@link #close(int, long)}
25+ * method expressing its intent to close the communication channel. Handlers are notified of this
26+ * intent and its up to the handlers to decide what's to be done next. Calling {@link #close(int,
27+ * long)} does not close the streams or do anything else besides notifying the handlers.
2728 */
2829public class IOTrio {
2930 private InputStream stdout ;
@@ -62,20 +63,22 @@ public void setStdin(OutputStream stdin) {
6263 /**
6364 * Capture the CLOSE intent and handle it accordingly.
6465 *
65- * @param handler the handler that's invoked when someone intends to close this communication. Multiple handlers can be registered
66+ * @param handler the handler that's invoked when someone intends to close this communication.
67+ * Multiple handlers can be registered
6668 */
6769 public void onClose (BiConsumer <Integer , Long > handler ) {
6870 closeHandlers .add (handler );
6971 }
7072
7173 /**
72- * Express an intent to close this communication. This intent will be relayed to all the registered handlers and it's up to them what
73- * to do with it.
74- * @param code proposed exit code
75- * @param timeout time in milliseconds given to terminate this communication. Negative timeout means no timeout (i.e. wait for as long
76- * as it takes). 0 means "stop it now".
74+ * Express an intent to close this communication. This intent will be relayed to all the
75+ * registered handlers and it's up to them what to do with it.
76+ *
77+ * @param code proposed exit code
78+ * @param timeout time in milliseconds given to terminate this communication. Negative timeout
79+ * means no timeout (i.e. wait for as long as it takes). 0 means "stop it now".
7780 */
7881 public void close (int code , long timeout ) {
7982 closeHandlers .forEach (handler -> handler .accept (code , timeout ));
8083 }
81- }
84+ }
0 commit comments