Example usage for com.fasterxml.jackson.core.format DataFormatMatcher getMatchedFormatName

List of usage examples for com.fasterxml.jackson.core.format DataFormatMatcher getMatchedFormatName

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core.format DataFormatMatcher getMatchedFormatName.

Prototype

public String getMatchedFormatName() 

Source Link

Document

Accessor for getting brief textual name of matched format if any (null if none).

Usage

From source file:org.waarp.common.json.AdaptativeJsonHandler.java

public AdaptativeJsonHandler(byte[] source) throws IOException {
    DataFormatMatcher match = detector.findFormat(source);
    if (match == null) {
        this.codec = JsonCodec.JSON;
        mapper = JsonCodec.JSON.mapper; // default
    } else {//from   www . ja  va2s.  co m
        JsonCodec codec = factoryForName.get(match.getMatchedFormatName());
        if (codec != null) {
            this.codec = codec;
            mapper = codec.mapper;
        } else {
            this.codec = JsonCodec.JSON;
            mapper = JsonCodec.JSON.mapper; // default
        }
    }
}

From source file:org.waarp.common.json.AdaptativeJsonHandler.java

public AdaptativeJsonHandler(InputStream source) throws IOException {
    DataFormatMatcher match = detector.findFormat(source);
    if (match == null) {
        this.codec = JsonCodec.JSON;
        mapper = JsonCodec.JSON.mapper; // default
    } else {//from   w  w  w.j  ava 2s  .co m
        JsonCodec codec = factoryForName.get(match.getMatchedFormatName());
        if (codec != null) {
            this.codec = codec;
            mapper = codec.mapper;
        } else {
            this.codec = JsonCodec.JSON;
            mapper = JsonCodec.JSON.mapper; // default
        }
    }
}