@Test public void testLimit() throws FileNotFoundException, IOException { Query query = new Query(Query.ALL); query.setMaxFeatures(3); SimpleFeatureSource rows = csvDataStore.getFeatureSource(); SimpleFeatureCollection matches = rows.getFeatures(query); List<String> limitCities = Arrays.asList("Trento", "St Paul", "Bangkok"); int count = 0; try (SimpleFeatureIterator iter = matches.features()) { while (iter.hasNext()) { SimpleFeature f = iter.next(); String city = (String) f.getAttribute("CITY"); assertTrue("Didn't find " + city, limitCities.contains(city)); count++; } } assertEquals(3, count); assertEquals(3, matches.size()); assertEquals(3, rows.getCount(query)); }
@Override public SimpleFeatureSource getFeatureSource() throws IOException { return super.getFeatureSource(getTypeName()); }
CSVDataStore extends ContentDataStore implements FileDataStore { @Override public SimpleFeatureSource getFeatureSource() throws IOException { return super.getFeatureSource(getTypeName()); } }
CSVDataStore extends ContentDataStore implements FileDataStore { @Override public SimpleFeatureSource getFeatureSource() throws IOException { return super.getFeatureSource(getTypeName()); } CSVDataStore(CSVFileState csvFileState, CSVStrategy csvStrategy); }
CSVDataStore extends ContentDataStore implements FileDataStore { @Override public SimpleFeatureSource getFeatureSource() throws IOException { return super.getFeatureSource(getTypeName()); } CSVDataStore(CSVFileState csvFileState, CSVStrategy csvStrategy); Name getTypeName(); @Override SimpleFeatureType getSchema(); @Override void updateSchema(SimpleFeatureType featureType); @Override SimpleFeatureSource getFeatureSource(); @Override FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(); @Override FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(
            Filter filter, Transaction transaction); @Override FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(Transaction transaction); @Override FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriterAppend(
            Transaction transaction); CSVStrategy getCSVStrategy(); @Override void createSchema(SimpleFeatureType featureType); }
CSVDataStore extends ContentDataStore implements FileDataStore { @Override public SimpleFeatureSource getFeatureSource() throws IOException { return super.getFeatureSource(getTypeName()); } CSVDataStore(CSVFileState csvFileState, CSVStrategy csvStrategy); Name getTypeName(); @Override SimpleFeatureType getSchema(); @Override void updateSchema(SimpleFeatureType featureType); @Override SimpleFeatureSource getFeatureSource(); @Override FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(); @Override FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(
            Filter filter, Transaction transaction); @Override FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(Transaction transaction); @Override FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriterAppend(
            Transaction transaction); CSVStrategy getCSVStrategy(); @Override void createSchema(SimpleFeatureType featureType);  }