summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/ioutils/BlockReader.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2017-04-06 14:14:37 -0400
committerbjculkin <bjculkin@mix.wvu.edu>2017-04-06 14:14:37 -0400
commit25382427eeafda30aa06a27f37c65fdaf8b67eba (patch)
tree109a2c5c4cd74ce47b961710952a26520bc17f90 /BJC-Utils2/src/main/java/bjc/utils/ioutils/BlockReader.java
parent622653daa9e991e9608852210034a4e09cb94167 (diff)
Reorganize blocks
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/ioutils/BlockReader.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/ioutils/BlockReader.java68
1 files changed, 0 insertions, 68 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/ioutils/BlockReader.java b/BJC-Utils2/src/main/java/bjc/utils/ioutils/BlockReader.java
deleted file mode 100644
index f019e09..0000000
--- a/BJC-Utils2/src/main/java/bjc/utils/ioutils/BlockReader.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package bjc.utils.ioutils;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.function.Consumer;
-
-/**
- * A source of blocks of characters, marked with line numbers as to block
- * start/block end.
- *
- * @author bjculkin
- *
- */
-public interface BlockReader extends AutoCloseable, Iterator<Block> {
- /**
- * Check if this reader has an available block.
- *
- * @return Whether or not another block is available.
- */
- boolean hasNextBlock();
-
- /**
- * Get the current block.
- *
- * @return The current block, or null if there is no current block.
- */
- Block getBlock();
-
- /**
- * Move to the next block.
- *
- * @return Whether or not the next block was successfully read.
- */
- boolean nextBlock();
-
- /**
- * Execute an action for each remaining block.
- *
- * @param action
- * The action to execute for each block
- */
- default void forEachBlock(Consumer<Block> action) {
- while (hasNext()) {
- action.accept(next());
- }
- }
-
- /**
- * Retrieve the number of blocks that have been read so far.
- *
- * @return The number of blocks read so far.
- */
- int getBlockCount();
-
- void close() throws IOException;
-
- @Override
- default boolean hasNext() {
- return hasNextBlock();
- }
-
- @Override
- default Block next() {
- nextBlock();
-
- return getBlock();
- }
-} \ No newline at end of file