mBuf.append(mDoc.substring(mCurIndex));
if (mJCases[mActiveJCas] == null) {
mJCases[mActiveJCas] = getEmptyJCas();
}
// add SourceDocumentInformation to active JCas
SourceDocumentInformation sdi = new SourceDocumentInformation(mJCases[mActiveJCas]);
sdi.setBegin(begin);
sdi.setEnd(mBuf.length());
sdi.setUri(getCasSourceUri(mCurrentInputCas));
sdi.addToIndexes();
mHasNext = false; // we need to see another input CAS before we can create output
mCurIndex = 0;
} else // yes, newline
{
// append doc up to newline
int begin = mBuf.length(); // record start offset of new text
mBuf.append(mDoc.substring(mCurIndex, nlIndex));
if (mJCases[mActiveJCas] == null) {
mJCases[mActiveJCas] = getEmptyJCas();
}
// add SourceDocumentInformation to active JCas
SourceDocumentInformation sdi = new SourceDocumentInformation(mJCases[mActiveJCas]);
sdi.setBegin(begin);
sdi.setEnd(mBuf.length());
sdi.setUri(getCasSourceUri(mCurrentInputCas));
sdi.addToIndexes();
// set doc text
mJCases[mActiveJCas].setDocumentText(mBuf.toString());
mBuf.setLength(0);
mCurIndex = nlIndex + 1;
mHasNext = true; // ready to output!