diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-09-09 21:46:16 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-09-09 21:47:34 -0300 |
| commit | d766896972c9e9be4a9e0021ec5f4f0665901865 (patch) | |
| tree | 1f6473300ef86e0697d682360bea0d28fc144baa /BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/SerialBlockReader.java | |
| parent | 40f3a28569366c4357fbda11d2fff3b77686d84f (diff) | |
Update
Most of it is documentation changes.
The rest is more work on BlockReaders, as well as a simple command
language for configuring them.
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/SerialBlockReader.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/SerialBlockReader.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/SerialBlockReader.java b/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/SerialBlockReader.java index 7735981..c229da1 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/SerialBlockReader.java +++ b/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/SerialBlockReader.java @@ -31,10 +31,15 @@ public class SerialBlockReader implements BlockReader { public boolean hasNextBlock() { if (readerQueue.isEmpty()) return false; + /* + * Attempt to get a block from the first reader. + */ boolean hasBlock = readerQueue.peek().hasNextBlock(); - boolean cont = hasBlock || readerQueue.isEmpty(); + /* + * Close/dispose of readers until we get an open one. + */ while (!cont) { try { readerQueue.pop().close(); @@ -43,7 +48,6 @@ public class SerialBlockReader implements BlockReader { } hasBlock = readerQueue.peek().hasNextBlock(); - cont = hasBlock || readerQueue.isEmpty(); } @@ -62,7 +66,6 @@ public class SerialBlockReader implements BlockReader { if (readerQueue.isEmpty()) return false; boolean gotBlock = readerQueue.peek().nextBlock(); - boolean cont = gotBlock || readerQueue.isEmpty(); while (!cont) { @@ -73,7 +76,6 @@ public class SerialBlockReader implements BlockReader { } gotBlock = readerQueue.peek().nextBlock(); - cont = gotBlock || readerQueue.isEmpty(); } @@ -97,4 +99,4 @@ public class SerialBlockReader implements BlockReader { reader.close(); } } -}
\ No newline at end of file +} |
