InputStream input;
try {
input = new FileInputStream(new File(f.fileName()));
ContentHandler textHandler = new BodyContentHandler(-1);
Metadata metadata = new Metadata();
RTFParser parser = new RTFParser();
ParseContext context = new ParseContext();
parser.parse(input, textHandler, metadata, context);
String[] result = textHandler.toString().split(regex);
for (int i=0; i<result.length && keepRunning; i++) {
addToIndex(r.getNoteGuid(), result[i], "RESOURCE");
}
input.close();