code: public synchronized Document next() {
          Document next = new StringDocument(nextLine);
          try {
              nextLine = documentsReader.readLine();
  
              // close the stream if there were no more lines
              if (nextLine == null) {
                  documentsReader.close();
              }
          } catch (Throwable t) {
              t.printStackTrace();
              nextLine = null;
          }
          return next;
      }
docs: Returns the next document from the file.