new FileOutputStream(url.getFile()));
_ostream = new FileOutputStream(url.getFile()));
    public SerializationHandler getOutputHandler(Result result) 	throws TransformerException     {	// Get output method using get() to ignore defaults 	_method = (String) _properties.get(OutputKeys.METHOD);	// Get encoding using getProperty() to use defaults	_encoding = (String) _properties.getProperty(OutputKeys.ENCODING);	_tohFactory = TransletOutputHandlerFactory.newInstance();	_tohFactory.setEncoding(_encoding);	if (_method != null) {	    _tohFactory.setOutputMethod(_method);	}	// Set indentation number in the factory	if (_indentNumber >= 0) {	    _tohFactory.setIndentNumber(_indentNumber);	}	// Return the content handler for this Result object	try {	    // Result object could be SAXResult, DOMResult, or StreamResult 	    if (result instanceof SAXResult) {                final SAXResult target = (SAXResult)result;                final ContentHandler handler = target.getHandler();		_tohFactory.setHandler(handler);                /**                 * Fix for bug 24414                 * If the lexicalHandler is set then we need to get that                 * for obtaining the lexical information                  */                LexicalHandler lexicalHandler = target.getLexicalHandler();                if (lexicalHandler != null ) {		    _tohFactory.setLexicalHandler(lexicalHandler);		}		_tohFactory.setOutputType(TransletOutputHandlerFactory.SAX);		return _tohFactory.getSerializationHandler();            }	    else if (result instanceof DOMResult) {		_tohFactory.setNode(((DOMResult) result).getNode());		_tohFactory.setOutputType(TransletOutputHandlerFactory.DOM);		return _tohFactory.getSerializationHandler();            }	    else if (result instanceof StreamResult) {		// Get StreamResult		final StreamResult target = (StreamResult) result;			// StreamResult may have been created with a java.io.File,		// java.io.Writer, java.io.OutputStream or just a String		// systemId. 		_tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);		// try to get a Writer from Result object		final Writer writer = target.getWriter();		if (writer != null) {		    _tohFactory.setWriter(writer);		    return _tohFactory.getSerializationHandler();		}		// or try to get an OutputStream from Result object		final OutputStream ostream = target.getOutputStream();		if (ostream != null) {		    _tohFactory.setOutputStream(ostream);		    return _tohFactory.getSerializationHandler();		}		// or try to get just a systemId string from Result object		String systemId = result.getSystemId();		if (systemId == null) {		    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR);                    throw new TransformerException(err.toString());		}		// System Id may be in one of several forms, (1) a uri		// that starts with 'file:', (2) uri that starts with 'http:'		// or (3) just a filename on the local system.		URL url = null;		if (systemId.startsWith("file:")) {                    url = new URL(systemId);		    _tohFactory.setOutputStream(		        new FileOutputStream(url.getFile()));		    return _tohFactory.getSerializationHandler();                }                else if (systemId.startsWith("http:")) {                    url = new URL(systemId);                    final URLConnection connection = url.openConnection();		    _tohFactory.setOutputStream(connection.getOutputStream());		    return _tohFactory.getSerializationHandler();                }                else {                    // system id is just a filename                    url = new File(systemId).toURL();		    _tohFactory.setOutputStream(		        new FileOutputStream(url.getFile()));		    return _tohFactory.getSerializationHandler();                }	    }	}        // If we cannot write to the location specified by the SystemId        catch (UnknownServiceException e) {            throw new TransformerException(e);        }        catch (ParserConfigurationException e) {            throw new TransformerException(e);        }        // If we cannot create the file specified by the SystemId        catch (IOException e) {            throw new TransformerException(e);        }	return null;    }