static int loadTextFilePart_iterator_chunkSize = 65536; // TODO: close on failure static Iterator loadTextFilePart_iterator(File file, long start, long end) { if (end-start <= loadTextFilePart_iterator_chunkSize) ret ll(loadTextFilePart(file, start, end)); final FileInputStream in = newFileInputStream(file); in.skip(start); final byte[] buf = new byte[loadTextFilePart_iterator_chunkSize]; final new UTF8Processor p; ret iteratorFF(func -> S { S s = readChunkThroughUTF8Processor(p, in, buf); ret empty(s) ? endMarker() : s; }); }