{
writer = factory.createXMLStreamWriter((OutputStream) output, outputEncoding);
}
catch (XMLStreamException e)
{
throw new StaxNavException(e);
}
}
else
{
try
{
writer = factory.createXMLStreamWriter((OutputStream) output);
}
catch (XMLStreamException e)
{
throw new StaxNavException(null, "Exception creating XMLStreamWriter with OutputStream: " + output, e);
}
}
}
else if (output instanceof Writer)
{
try
{
writer = factory.createXMLStreamWriter((Writer) output);
}
catch (XMLStreamException e)
{
throw new StaxNavException(null, "Exception creating XMLStreamWriter with Writer: " + output, e);
}
}
else if (output instanceof Result)
{
try
{
writer = factory.createXMLStreamWriter((Result) output);
}
catch (XMLStreamException e)
{
throw new StaxNavException(null, "Exception creating XMLStreamWriter with Result: " + output, e);
}
}
else
{
throw new IllegalStateException("Unknown output: " + output); // should never happen...