code: public static <MSG extends Message> CloseableIterator<MSG> readStream(InputStream input, Parser<MSG> parser) {
      // the stream is closed by the CloseableIterator
      return new StreamIterator<>(parser, input);
    }
docs: Reads a stream of messages. This method returns an empty iterator if there are no messages. An
  exception is raised on IO error or if messages have a different type than {@code parser}.
  <p>
  The stream is not closed by this method. It is closed when {@link CloseableIterator} traverses
  all messages or when {@link CloseableIterator#close()} is called.
  </p>