@Test public void testReadFeatures() throws IOException { try (FeatureReader<SimpleFeatureType, SimpleFeature> reader = csvDataStore.getFeatureReader()) { List<Coordinate> geometries = new ArrayList<>(); List<String> cities = new ArrayList<>(); List<String> numbers = new ArrayList<>(); while (reader.hasNext()) { SimpleFeature feature = reader.next(); Point geometry = (Point) feature.getDefaultGeometry(); geometries.add(geometry.getCoordinate()); cities.add(feature.getAttribute("CITY").toString()); numbers.add(feature.getAttribute("NUMBER").toString()); } List<Coordinate> expectedCoordinates = makeExpectedCoordinates( 46.066667, 11.116667, 44.9441, -93.0852, 13.752222, 100.493889, 45.420833, -75.69, 44.9801, -93.251867, 46.519833, 6.6335, 48.428611, -123.365556, -33.925278, 18.423889, -33.859972, 151.211111); assertEquals("Unexpected coordinates", expectedCoordinates, geometries); List<String> expectedCities = Arrays.asList( "Trento, St Paul, Bangkok, Ottawa, Minneapolis, Lausanne, Victoria, Cape Town, Sydney" .split(", ")); assertEquals("Unexecpted cities", expectedCities, cities); List<String> expectedNumbers = Arrays.asList("140, 125, 150, 200, 350, 560, 721, 550, 436".split(", ")); assertEquals("Unexpected numbers", expectedNumbers, numbers); } }
@Override public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader() throws IOException { return new CSVFeatureSource(this).getReader(); }
CSVDataStore extends ContentDataStore implements FileDataStore { @Override public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader() throws IOException { return new CSVFeatureSource(this).getReader(); } }
CSVDataStore extends ContentDataStore implements FileDataStore { @Override public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader() throws IOException { return new CSVFeatureSource(this).getReader(); } CSVDataStore(CSVFileState csvFileState, CSVStrategy csvStrategy); }
CSVDataStore extends ContentDataStore implements FileDataStore { @Override public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader() throws IOException { return new CSVFeatureSource(this).getReader(); } 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 FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader() throws IOException { return new CSVFeatureSource(this).getReader(); } 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);  }