if (DocumentFormat.XCAS.equals(format)) {
try {
XCASSerializer.serialize(cas, out);
} catch (SAXException e) {
// should not happen
throw new TaeError(failedToImportLine + e.getMessage(), e);
} catch (IOException e) {
// will not happen, writing to memory
throw new TaeError(failedToImportLine + e.getMessage(), e);
}
}
else if (DocumentFormat.XMI.equals(format)) {
try {
XmiCasSerializer.serialize(cas, out);
} catch (SAXException e) {
// should not happen
throw new TaeError(failedToImportLine + e.getMessage(), e);
}
} else {
throw new TaeError(failedToImportLine + "Unkown document type!", null);
}
return new ByteArrayInputStream(out.toByteArray());
}