Skip to content

Commit

Permalink
Update XmlFactory.java
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed May 1, 2023
1 parent c53a071 commit 1e0ec22
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/main/java/com/fasterxml/jackson/dataformat/xml/XmlFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,21 @@ public ToXmlGenerator createGenerator(OutputStream out, JsonEncoding enc) throws
}

/**
* @param out
* @param encoding
* @return
* Method for constructing a {@link ToXmlGenerator} for writing XML content
* using specified output stream.
* Encoding to use must be specified.
*<p>
* Underlying stream <b>is NOT owned</b> by the generator constructed,
* so that generator will NOT close the output stream when
* {@link ToXmlGenerator#close} is called (unless auto-closing
* feature,
* {@link com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET}
* is enabled).
* Using application needs to close it explicitly if this is the case.
*
* @param out OutputStream to use for writing JSON content
* @param encoding Character encoding to use
* @return a {@link ToXmlGenerator} instance
* @throws IOException
* @since 2.16
*/
Expand All @@ -537,6 +549,7 @@ public ToXmlGenerator createGenerator(OutputStream out, String encoding) throws
@Override
public ToXmlGenerator createGenerator(Writer out) throws IOException
{
super.createGenerator(out);
final IOContext ctxt = _createContext(_createContentReference(out), false);
return new ToXmlGenerator(ctxt,
_generatorFeatures, _xmlGeneratorFeatures,
Expand Down

0 comments on commit 1e0ec22

Please sign in to comment.