Package org.codehaus.jackson.format
Class DataFormatMatcher
- java.lang.Object
-
- org.codehaus.jackson.format.DataFormatMatcher
-
public class DataFormatMatcher extends Object
Result object constructed byDataFormatDetectorwhen requested to detect format of given input data.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]_bufferedDataContent read during format matching processprotected int_bufferedLengthNumber of bytes in_bufferedDatathat were read.protected JsonFactory_matchFactory that produced sufficient match (if any)protected MatchStrength_matchStrengthStrength of match with_matchprotected InputStream_originalStream
-
Constructor Summary
Constructors Modifier Constructor Description protectedDataFormatMatcher(InputStream in, byte[] buffered, int bufferedLength, JsonFactory match, MatchStrength strength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonParsercreateParserWithMatch()Convenience method for trying to construct aJsonParserfor parsing content which is assumed to be in detected data format.InputStreamgetDataStream()Method to use for accessing input for which format detection has been done.JsonFactorygetMatch()Accessor forJsonFactorythat represents format that data matched.StringgetMatchedFormatName()Accessor for getting brief textual name of matched format if any (null if none).MatchStrengthgetMatchStrength()Method for accessing strength of the match, if any; if no match, will returnMatchStrength.INCONCLUSIVE.booleanhasMatch()Accessor to use to see if any formats matched well enough with the input data.
-
-
-
Field Detail
-
_originalStream
protected final InputStream _originalStream
-
_bufferedData
protected final byte[] _bufferedData
Content read during format matching process
-
_bufferedLength
protected final int _bufferedLength
Number of bytes in_bufferedDatathat were read.
-
_match
protected final JsonFactory _match
Factory that produced sufficient match (if any)
-
_matchStrength
protected final MatchStrength _matchStrength
Strength of match with_match
-
-
Constructor Detail
-
DataFormatMatcher
protected DataFormatMatcher(InputStream in, byte[] buffered, int bufferedLength, JsonFactory match, MatchStrength strength)
-
-
Method Detail
-
hasMatch
public boolean hasMatch()
Accessor to use to see if any formats matched well enough with the input data.
-
getMatchStrength
public MatchStrength getMatchStrength()
Method for accessing strength of the match, if any; if no match, will returnMatchStrength.INCONCLUSIVE.
-
getMatch
public JsonFactory getMatch()
Accessor forJsonFactorythat represents format that data matched.
-
getMatchedFormatName
public String getMatchedFormatName()
Accessor for getting brief textual name of matched format if any (null if none). Equivalent to:return hasMatch() ? getMatch().getFormatName() : null;
-
createParserWithMatch
public JsonParser createParserWithMatch() throws IOException
Convenience method for trying to construct aJsonParserfor parsing content which is assumed to be in detected data format. If no match was found, returns null.- Throws:
IOException
-
getDataStream
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.
-
-