summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/BlockReader.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-08 22:39:59 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-08 22:39:59 -0300
commitc82e3b3b2de0633317ec8fc85925e91422820597 (patch)
tree96567416ce23c5ce85601f9cedc3a94bb1c55cba /BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/BlockReader.java
parentb3ac1c8690c3e14c879913e5dcc03a5f5e14876e (diff)
Start splitting into maven modules
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/BlockReader.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/BlockReader.java73
1 files changed, 0 insertions, 73 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/BlockReader.java b/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/BlockReader.java
deleted file mode 100644
index 3c695c6..0000000
--- a/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/BlockReader.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package bjc.utils.ioutils.blocks;
-
-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();
-
- /**
- * Retrieve the number of blocks that have been read so far.
- *
- * @return The number of blocks read so far.
- */
- int getBlockCount();
-
- @Override
- void close() throws IOException;
-
- /*
- * Methods with default impls.
- */
-
- /**
- * Execute an action for each remaining block.
- *
- * @param action
- * The action to execute for each block
- */
- default void forEachBlock(final Consumer<Block> action) {
- while (hasNext()) {
- action.accept(next());
- }
- }
-
- @Override
- default boolean hasNext() {
- return hasNextBlock();
- }
-
- @Override
- default Block next() {
- nextBlock();
-
- return getBlock();
- }
-}