Software Development

Parse CSV file uploaded as MultipartFile using Apache Commons CSV

From MultiPartFile to Reader object

[wp_ad_camp_5]

The parse method only accepts a single java.io.Reader object and you may need to convert the MultipartFile object to a Reader object. The MultipartFile class has the getInputStream() whose return value can be passed to the constructor of the ImputStreamReader class. The an object of type ImputStreadReader is passed to the parse method.

A multipart resolver is required to make this work. Place the following codes in you @Configuration class.

[wp_ad_camp_2]

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like