I am trying to read in a large (700 GB) file and gradually process it, but the network I am working on will sometimes drop by disabling access to the file. This raises a java.io.IOException telling me that "the specified network name is no longer available." Is there a way I can catch this exception and wait for, say, fifteen minutes, and then repeat the reading, or is the Reader object fried after access to the file is lost?
If the Reader is useless after the connection is lost, is there a way I can rewrite it so that I can "save my place" and then start reading from there, without having to read and discard all the data before it? Even just buzzing data without processing takes a long time when 500 GB is required.
Currently, the code looks something like this (edited for brevity):
class Processor {
BufferedReader br;
Processor(String fname) {
br = new BufferedReader(new FileReader("fname"));
}
void process() {
try {
String line;
while((line=br.readLine)!=null) {
...code for processing the line goes here...
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
Thank you for your time.
Shiro source
share