@SuppressWarnings("unchecked")
    static <T> T parseObject(InputStream input, Type type, String format, JSONReader.Feature... features) {
        if (input == null) {
            return null;
        }

        final JSONReader.Context context = JSONFactory.createReadContext(features);
        if (format != null && !format.isEmpty()) {
            context.setDateFormat(format);
        }
        ObjectReader<T> objectReader = context.getObjectReader(type);

        try (JSONReader reader = JSONReader.of(input, StandardCharsets.UTF_8, context)) {
            T object = objectReader.readObject(reader, type, null, 0);
            if (reader.resolveTasks != null) {
                reader.handleResolveTasks(object);
            }
            if (reader.ch != EOI && (context.features & IgnoreCheckClose.mask) == 0) {
                throw new JSONException(reader.info("input not end"));
            }
            return object;
        }
    }
Parses the json stream as a {@link T}. Returns {@code null}
if received {@link InputStream} is {@code null} or its content is null.

@param input the specified stream to be parsed
@param type the specified actual type of {@link T}
@param format the specified date format
@param features the specified features is applied to parsing
@return {@link T} or {@code null}
@throws JSONException If a parsing error occurs
core/src/main/java/com/alibaba/fastjson2/JSON.java