Package org.codehaus.jackson.format
Class DataFormatMatcher
java.lang.Object
org.codehaus.jackson.format.DataFormatMatcher
Result object constructed by
DataFormatDetector
when requested
to detect format of given input data.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final byte[]
Content read during format matching processprotected final int
Number of bytes in_bufferedData
that were read.protected final JsonFactory
Factory that produced sufficient match (if any)protected final MatchStrength
Strength of match with_match
protected final InputStream
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DataFormatMatcher
(InputStream in, byte[] buffered, int bufferedLength, JsonFactory match, MatchStrength strength) -
Method Summary
Modifier and TypeMethodDescriptionConvenience method for trying to construct aJsonParser
for parsing content which is assumed to be in detected data format.Method to use for accessing input for which format detection has been done.getMatch()
Accessor forJsonFactory
that represents format that data matched.Accessor for getting brief textual name of matched format if any (null if none).Method for accessing strength of the match, if any; if no match, will returnMatchStrength.INCONCLUSIVE
.boolean
hasMatch()
Accessor to use to see if any formats matched well enough with the input data.
-
Field Details
-
_originalStream
-
_bufferedData
protected final byte[] _bufferedDataContent read during format matching process -
_bufferedLength
protected final int _bufferedLengthNumber of bytes in_bufferedData
that were read. -
_match
Factory that produced sufficient match (if any) -
_matchStrength
Strength of match with_match
-
-
Constructor Details
-
DataFormatMatcher
protected DataFormatMatcher(InputStream in, byte[] buffered, int bufferedLength, JsonFactory match, MatchStrength strength)
-
-
Method Details
-
hasMatch
public boolean hasMatch()Accessor to use to see if any formats matched well enough with the input data. -
getMatchStrength
Method for accessing strength of the match, if any; if no match, will returnMatchStrength.INCONCLUSIVE
. -
getMatch
Accessor forJsonFactory
that represents format that data matched. -
getMatchedFormatName
Accessor for getting brief textual name of matched format if any (null if none). Equivalent to:return hasMatch() ? getMatch().getFormatName() : null;
-
createParserWithMatch
Convenience method for trying to construct aJsonParser
for parsing content which is assumed to be in detected data format. If no match was found, returns null.- Throws:
IOException
-
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.
-