public class

DataFormatMatcher

extends Object
java.lang.Object
   ↳ com.fasterxml.jackson.core.format.DataFormatMatcher

Class Overview

Result object constructed by DataFormatDetector when requested to detect format of given input data.

Summary

Fields
protected final byte[] _bufferedData Content read during format matching process
protected final int _bufferedLength Number of bytes in _bufferedData that were read.
protected final JsonFactory _match Factory that produced sufficient match (if any)
protected final MatchStrength _matchStrength Strength of match with _match
protected final InputStream _originalStream
Protected Constructors
DataFormatMatcher(InputStream in, byte[] buffered, int bufferedLength, JsonFactory match, MatchStrength strength)
Public Methods
JsonParser createParserWithMatch()
Convenience method for trying to construct a JsonParser for parsing content which is assumed to be in detected data format.
InputStream getDataStream()
Method to use for accessing input for which format detection has been done.
JsonFactory getMatch()
Accessor for JsonFactory that represents format that data matched.
MatchStrength getMatchStrength()
Method for accessing strength of the match, if any; if no match, will return INCONCLUSIVE.
String getMatchedFormatName()
Accessor for getting brief textual name of matched format if any (null if none).
boolean hasMatch()
Accessor to use to see if any formats matched well enough with the input data.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected final byte[] _bufferedData

Content read during format matching process

protected final int _bufferedLength

Number of bytes in _bufferedData that were read.

protected final JsonFactory _match

Factory that produced sufficient match (if any)

protected final MatchStrength _matchStrength

Strength of match with _match

protected final InputStream _originalStream

Protected Constructors

protected DataFormatMatcher (InputStream in, byte[] buffered, int bufferedLength, JsonFactory match, MatchStrength strength)

Public Methods

public JsonParser createParserWithMatch ()

Convenience method for trying to construct a JsonParser for parsing content which is assumed to be in detected data format. If no match was found, returns null.

Throws
IOException

public InputStream getDataStream ()

Method to use for accessing input for which format detection has been done. This must be used instead of using stream passed to detector unless given stream itself can do buffering. Stream will return all content that was read during matching process, as well as remaining contents of the underlying stream.

public JsonFactory getMatch ()

Accessor for JsonFactory that represents format that data matched.

public MatchStrength getMatchStrength ()

Method for accessing strength of the match, if any; if no match, will return INCONCLUSIVE.

public String getMatchedFormatName ()

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

   return hasMatch() ? getMatch().getFormatName() : null;

public boolean hasMatch ()

Accessor to use to see if any formats matched well enough with the input data.