// retreive the filename of the input file from the CAS
FSIterator it = jcas.getAnnotationIndex(SourceDocumentInformation.type).iterator();
File outFile = null;
if (it.hasNext()) {
SourceDocumentInformation fileLoc = (SourceDocumentInformation) it.next();
File inFile;
try {
// handle blanks in path
// https://issues.apache.org/jira/browse/UIMA-1748
// use 3 arg form of URI Constructor to properly quote any otherwise illegal chars such as blank
// https://issues.apache.org/jira/browse/UIMA-2097
URI uri = UriUtils.quote(fileLoc.getUri());
inFile = new File(uri);
String outFileName = inFile.getName();
if (fileLoc.getOffsetInSource() > 0) {
outFileName += fileLoc.getOffsetInSource();
}
outFile = new File(mOutputDir, outFileName);
} catch (URISyntaxException e) {
// invalid URL, use default processing below
}