|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fasterxml.jackson.core.format.DataFormatDetector
public class DataFormatDetector
Simple helper class that allows data format (content type) auto-detection,
given an ordered set of JsonFactory instances to use for actual low-level
detection.
| Field Summary | |
|---|---|
protected JsonFactory[] |
_detectors
Ordered list of factories which both represent data formats to detect (in precedence order, starting with highest) and are used for actual detection. |
protected int |
_maxInputLookahead
Maximum number of leading bytes of the input that we can read to determine data format. |
protected MatchStrength |
_minimalMatch
Strength of minimal match we accept as the answer, unless better matches are found. |
protected MatchStrength |
_optimalMatch
Strength of match we consider to be good enough to be used without checking any other formats. |
static int |
DEFAULT_MAX_INPUT_LOOKAHEAD
By default we will look ahead at most 64 bytes; in most cases, much less (4 bytes or so) is needed, but we will allow bit more leniency to support data formats that need more complex heuristics. |
| Constructor Summary | |
|---|---|
DataFormatDetector(Collection<JsonFactory> detectors)
|
|
DataFormatDetector(JsonFactory... detectors)
|
|
| Method Summary | |
|---|---|
DataFormatMatcher |
findFormat(byte[] fullInputData)
Method to call to find format that given content (full document) has, as per configuration of this detector instance. |
DataFormatMatcher |
findFormat(InputStream in)
Method to call to find format that content (accessible via given InputStream) given has, as per configuration of this detector
instance. |
DataFormatDetector |
withMaxInputLookahead(int lookaheadBytes)
Method that will return a detector instance that allows detectors to read up to specified number of bytes when determining format match strength. |
DataFormatDetector |
withMinimalMatch(MatchStrength minMatch)
Method that will return a detector instance that uses given minimal match level; match that may be returned unless a stronger match is found with other format detectors. |
DataFormatDetector |
withOptimalMatch(MatchStrength optMatch)
Method that will return a detector instance that uses given optimal match level (match that is considered sufficient to return, without trying to find stronger matches with other formats). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MAX_INPUT_LOOKAHEAD
protected final JsonFactory[] _detectors
protected final MatchStrength _optimalMatch
MatchStrength.SOLID_MATCH,
protected final MatchStrength _minimalMatch
MatchStrength.WEAK_MATCH,
protected final int _maxInputLookahead
Default value is DEFAULT_MAX_INPUT_LOOKAHEAD.
| Constructor Detail |
|---|
public DataFormatDetector(JsonFactory... detectors)
public DataFormatDetector(Collection<JsonFactory> detectors)
| Method Detail |
|---|
public DataFormatDetector withOptimalMatch(MatchStrength optMatch)
public DataFormatDetector withMinimalMatch(MatchStrength minMatch)
public DataFormatDetector withMaxInputLookahead(int lookaheadBytes)
public DataFormatMatcher findFormat(InputStream in)
throws IOException
InputStream) given has, as per configuration of this detector
instance.
IOException
public DataFormatMatcher findFormat(byte[] fullInputData)
throws IOException
IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||