@SuppressWarnings("resource")
    public static XMLWriter from(Writer writer, int maxIndentLevel,int maxLineSeparatorLevel) {
        return (writer instanceof XMLWriter)
                ? (XMLWriter)writer
                : new XMLWriter(writer, maxIndentLevel, maxLineSeparatorLevel);
    }
Returns the input writer as-is if it is an XMLWriter instance. Returns new XMLWriter(writer) otherwise
vespajlib/src/main/java/com/yahoo/text/XMLWriter.java