FilesCollectionReader extends JCasCollectionReader_ImplBase { public static CollectionReaderDescription getDescriptionWithSuffixes( String dir, String viewName, String... suffixes) throws ResourceInitializationException { return CollectionReaderFactory.createReaderDescription( FilesCollectionReader.class, PARAM_ROOT_FILE, dir, PARAM_VIEW_NAME, viewName, PARAM_SUFFIXES, suffixes); }  static CollectionReaderDescription getDescription(String fileOrDir); static CollectionReader getCollectionReader(String fileOrDir); static CollectionReaderDescription getDescriptionWithView(String dir, String viewName); static CollectionReader getCollectionReaderWithView(String dir, String viewName); static CollectionReaderDescription getDescriptionWithPatterns(
      String dir,
      String viewName,
      String... patterns); static CollectionReader getCollectionReaderWithPatterns(
      String dir,
      String viewName,
      String... patterns); static CollectionReaderDescription getDescriptionWithSuffixes(
      String dir,
      String viewName,
      String... suffixes); static CollectionReader getCollectionReaderWithSuffixes(
      String dir,
      String viewName,
      String... suffixes); @Override void initialize(UimaContext context); void getNext(JCas jCas); Progress[] getProgress(); boolean hasNext(); void close(); static final String PARAM_ROOT_FILE; static final String PARAM_VIEW_NAME; static final String PARAM_LANGUAGE; static final String PARAM_ENCODING; static final String PARAM_SUFFIXES; static final String PARAM_PATTERNS; static final String PARAM_NAME_FILES_FILE_NAMES; static final String PARAM_FILE_NAMES; static final String PARAM_IGNORE_SYSTEM_FILES; }
@Test public void testSuffixes() throws Exception { CollectionReaderDescription desc = FilesCollectionReader.getDescriptionWithSuffixes( this.inputDir, CAS.NAME_DEFAULT_SOFA, "1.html"); Set<String> pathsSet = new HashSet<String>(); pathsSet.addAll(Arrays.asList(this.pathsSuffix1)); for (JCas jc : new JCasIterable(desc)) { String docPath = ViewUriUtil.getURI(jc).toString(); assertTrue(pathsSet.contains(docPath)); pathsSet.remove(docPath); } assertTrue(pathsSet.isEmpty()); }
@Test public void testSuffixes2() throws Exception { CollectionReaderDescription desc = FilesCollectionReader.getDescriptionWithSuffixes( this.inputDir, CAS.NAME_DEFAULT_SOFA, "1.html", "2.html"); Set<String> pathsSet = new HashSet<String>(); pathsSet.addAll(Arrays.asList(this.pathsSuffix2)); for (JCas jc : new JCasIterable(desc)) { String docPath = ViewUriUtil.getURI(jc).toString(); assertTrue(pathsSet.contains(docPath)); pathsSet.remove(docPath); } assertTrue(pathsSet.isEmpty()); }