public static List<ReutersDocument> extract(Path reutersDir) throws IOException, ParseException {
  List<ReutersDocument> docs=new ArrayList<>();
  DirectoryStream<Path> stream=Files.newDirectoryStream(reutersDir,"*.sgm");
  for (  Path sgmFile : stream) {
    InputStream inputStream=Files.newInputStream(sgmFile);
    docs.addAll(extractFile(inputStream,sgmFile.toUri()));
  }
  return docs;
}

public static List < ReutersDocument > extract ( Path reutersDir ) throws IOException , ParseException { List < ReutersDocument > docs = new ArrayList < > ( ) ; DirectoryStream < Path > stream = Files . newDirectoryStream ( reutersDir , "*.sgm" ) ; for ( Path sgmFile : stream ) { InputStream inputStream = Files . newInputStream ( sgmFile ) ; docs . addAll ( extractFile ( inputStream , sgmFile . toUri ( ) ) ) ; } return docs ; }
read all the sgml file in the given directory .
