Jeff Verdegan wrote:You might see if NB offers something similar.
Stephan van Hulst wrote:Perhaps you can take a look at what the documentation says about the possible parameters for Files.newBufferedWriter().
Richard Tookey wrote:
Surely that can't be the correct approach since you are unlikely to have access to the 'prices' array when you read back the data. You need to write this length to the output file so it can be read back and used to create the correct length of array !
Richard Tookey wrote:You get the exception because you try to read more data than you have written. You have two obvious choices -
1) Catch the exception and recognize that when you get an EOF exception that you have read all the data.
2) Write the number of data items to be written before you actually write them. You can then read read this number back to know how many data items to read.
I consider the first approach to be a hack and would recommend the second approach.