I am allowing our users to upload .csv files, but was having a little trouble deciding how to parse the file content. Normally, I'd wrap the .csv file in a BufferedReader and read it line by line, but with a FormFile object, I only have an InputStream to read the file data. I'm going to add each line in the file to a List object to save to a database.
I'm not a big I/O API expert, so does someone have a clean way to read the .csv data using the Struts FormFile object?
Do not do this. ready() does not tell you if the stream has ended, it tells you if a read call will block:
Returns:
True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.