After taking a look to geotools quickstart: https://docs.geotools.org/latest/userguide/tutorial/quickstart/intellij.html
It shows an example of recovering the features of a shape, using this code:
File file = new File("myfile.shp");
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureSource featureSource = store.getFeatureSource();
FeatureCollection collection = featureSource.getFeatures();
FeatureIterator iterator = collection.features();
However this code has a dependency on File
. In my real project shape content is provided me as a byte array and I cannot create a temp file. So, how can I access features?
This is my code so far
public static Map<String,Vector<String>> getAllPropsValues(byte[] fileContent){
//Some other code here
DataStore store = DataStoreFinder.getDataStore(fileContent); //<-- how to replace this line
SimpleFeatureSource featureSource = store.getFeatureSource();
FeatureCollection collection = featureSource.getFeatures();
FeatureIterator iterator = collection.features();
//other things here
}