Skip to content

Commit 1e0ec22

Browse files
committed
Update XmlFactory.java
1 parent c53a071 commit 1e0ec22

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/main/java/com/fasterxml/jackson/dataformat/xml/XmlFactory.java

+16-3
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,21 @@ public ToXmlGenerator createGenerator(OutputStream out, JsonEncoding enc) throws
519519
}
520520

521521
/**
522-
* @param out
523-
* @param encoding
524-
* @return
522+
* Method for constructing a {@link ToXmlGenerator} for writing XML content
523+
* using specified output stream.
524+
* Encoding to use must be specified.
525+
*<p>
526+
* Underlying stream <b>is NOT owned</b> by the generator constructed,
527+
* so that generator will NOT close the output stream when
528+
* {@link ToXmlGenerator#close} is called (unless auto-closing
529+
* feature,
530+
* {@link com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET}
531+
* is enabled).
532+
* Using application needs to close it explicitly if this is the case.
533+
*
534+
* @param out OutputStream to use for writing JSON content
535+
* @param encoding Character encoding to use
536+
* @return a {@link ToXmlGenerator} instance
525537
* @throws IOException
526538
* @since 2.16
527539
*/
@@ -537,6 +549,7 @@ public ToXmlGenerator createGenerator(OutputStream out, String encoding) throws
537549
@Override
538550
public ToXmlGenerator createGenerator(Writer out) throws IOException
539551
{
552+
super.createGenerator(out);
540553
final IOContext ctxt = _createContext(_createContentReference(out), false);
541554
return new ToXmlGenerator(ctxt,
542555
_generatorFeatures, _xmlGeneratorFeatures,

0 commit comments

Comments
 (0)