public void parse()

in src/main/java/org/apache/sling/contentparser/json/internal/JSONContentParser.java [56:84]


    public void parse(ContentHandler handler, InputStream is, ParserOptions parserOptions) throws IOException {
        final boolean jsonQuoteTicks;
        final boolean supportComments;
        if (parserOptions instanceof JSONParserOptions) {
            JSONParserOptions jsonParserOptions = (JSONParserOptions) parserOptions;
            jsonQuoteTicks = jsonParserOptions.getFeatures().contains(JSONParserFeature.QUOTE_TICK);
            supportComments = jsonParserOptions.getFeatures().contains(JSONParserFeature.COMMENTS);
        } else {
            jsonQuoteTicks = false;
            supportComments = false;
        }

        /*
         * Implementation note: This parser uses JsonReader instead of the (more memory-efficient)
         * JsonParser Stream API because otherwise it would not be possible to report parent resources
         * including all properties properly before their children.
         */
        Map<String, Object> jsonReaderFactoryConfiguration;
        if (supportComments) {
            jsonReaderFactoryConfiguration = new HashMap<>();
            jsonReaderFactoryConfiguration.put(JOHNZON_SUPPORT_COMMENTS, true);
        } else {
            jsonReaderFactoryConfiguration = Collections.emptyMap();
        }
        final JsonReaderFactory jsonReaderFactory = Json.createReaderFactory(jsonReaderFactoryConfiguration);
        JsonObject jsonObject =
                jsonQuoteTicks ? toJsonObjectWithJsonTicks(jsonReaderFactory, is) : toJsonObject(jsonReaderFactory, is);
        parse(handler, jsonObject, parserOptions, "/");
    }