I have such a method:
public <T> Flux<T> deserialize(MultipartFile multipartFile, Class<T> type) {
BufferedReader reader = new BufferedReader(new InputStreamReader(multipartFile.getInputStream()));
MappingStrategy<T> ms = new HeaderColumnNameMappingStrategy<>();
ms.setType(type);
CsvToBean<T> cb = new CsvToBeanBuilder<T>(reader)
.withType(type)
.withMappingStrategy(ms)
.build();
return Flux.fromStream(cb.stream());
}
which takes multipart file and returns a flux based on stream of records from this CSV file. Question: is there any way to get a stream of something like Either<Class, Exception>?
I've seen this post but the answer uses .parse() which would not be appropriate for big CSV files.