garydgregory commented on code in PR #447:
URL: https://github.com/apache/commons-io/pull/447#discussion_r1168005091
##########
src/main/java/org/apache/commons/io/input/QueueInputStream.java:
##########
@@ -88,12 +111,32 @@ public QueueOutputStream newQueueOutputStream() {
/**
* Reads and returns a single byte.
*
- * @return either the byte read or {@code -1} if the end of the stream has
been reached
+ * @return either the byte read or {@code -1} immediately if the queue is
empty.
*/
@Override
public int read() {
final Integer value = blockingQueue.poll();
return value == null ? EOF : 0xFF & value;
}
+ private static class BlockingQueueInputStream extends QueueInputStream {
+
+ public BlockingQueueInputStream(final BlockingQueue<Integer>
blockingQueue) {
+ super(blockingQueue);
+ }
+
+ @Override
+ public int read() {
+ try {
+ return blockingQueue.take();
+ } catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
+ final InterruptedIOException ioException = new
InterruptedIOException();
Review Comment:
@maxxedev
This seems unusual, why not simply use `throw new UncheckedIOException(e)`?
--
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]