* returned to the pool (if it was allocated from a pool.)
*/
public void toStream(OutputStream os) throws IOException {
try {
UIMAFramework.getLogger().log(Level.FINEST, "Serializing CAS.");
XCASSerializer xcasSerializer = new XCASSerializer(myCas.getTypeSystem(), this.uimaContext);
// Not sure why we need to do the next two lines:
xcasSerializer.setDocumentTypeName(Constants.VINCI_DETAG);
xcasSerializer.setDocumentTextFeature(null);
XTalkSerializer s = new XTalkSerializer(os, xcasSerializer);
try {
xcasSerializer.serialize(myCas, s, includeDocText, outOfTypeSystemData);
} catch (org.xml.sax.SAXException e) {
//if SAXException wraps an IOException, throw the IOException. This is
//important since different types of IOExceptions (e.g. SocketTimeoutExceptions)
//are treated differently by Vinci
throw convertToIOException(e);