garydgregory commented on code in PR #447:
URL: https://github.com/apache/commons-io/pull/447#discussion_r1162907587


##########
src/main/java/org/apache/commons/io/input/QueueInputStream.java:
##########
@@ -86,12 +99,24 @@ public QueueOutputStream newQueueOutputStream() {
     }
 
     /**
-     * Reads and returns a single byte.
+     * Reads and returns a single byte. In blocking read mode, the method will 
wait if necessary until a queue element
+     * becomes available. In non-blocking read mode, the method will return -1 
immediately if the queue is empty.
      *
      * @return either the byte read or {@code -1} if the end of the stream has 
been reached
+     * @throws InterruptedIOException if the thread is interrupted while 
reading from the queue.
      */
     @Override
-    public int read() {
+    public int read() throws InterruptedIOException {

Review Comment:
   -1; I'm not a fan of this style because it is the opposite of OO: For each 
char, we test and execute one branch or another _based on state that never 
changes_, which tells me this should be implemented either as a subclass or 
pluggable strategy (with a lambda for example). IOW, this could likely be best 
as a separate class. Thoughts?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to