code: private void getNextFileToRead() throws IOException {
      if (this.currentFile != null && this.currentFileItr != null) {
        closeCurrentFile();
        incrementBytesReadCounter();
      }
  
      while (!this.hasNext && !this.filesToPull.isEmpty()) {
        this.currentFile = this.filesToPull.remove(0);
        this.currentFileItr = downloadFile(this.currentFile);
        this.hasNext = this.currentFileItr == null ? false : this.currentFileItr.hasNext();
        LOG.info("Will start downloading file: " + this.currentFile);
      }
    }
docs: If a previous file has been read, first close that file. Then search through {@link #filesToPull} to find the first
  non-empty file.