implement closable interface in filesegment re:
@@ -22,6 +22,7 @@ import java.nio.file.Path;
import java.text.ParseException;
import java.util.NoSuchElementException;
import java.util.Iterator;
+import java.io.Closeable;
/**
* Base implementation for a {@link FileSegment}.
@@ -29,7 +30,7 @@ import java.util.Iterator;
* existence outside a collection, and in principle multiple collections might share the same
* {@code FileSegment} implementation.
*/
-public abstract class FileSegment<T extends SourceDocument> implements Iterable<T> {
+public abstract class FileSegment<T extends SourceDocument> implements Iterable<T>, Closeable {
protected Path path;
protected final int BUFFER_SIZE = 1 << 16; // 64K
@@ -67,6 +68,7 @@ public abstract class FileSegment<T extends SourceDocument> implements Iterable<
return path;
}
+ @Override
public void close() throws IOException {
atEOF = true;
bufferedRecord = null;
