Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.core.format;
Result object constructed by DataFormatDetector when requested to detect format of given input data.
 public class DataFormatMatcher
     protected final InputStream _originalStream;

Content read during format matching process
     protected final byte[] _bufferedData;

Pointer to the first byte in buffer available for reading
     protected final int _bufferedStart;
Number of bytes available in buffer.
     protected final int _bufferedLength;

Factory that produced sufficient match (if any)
     protected final JsonFactory _match;

Strength of match with _match
     protected final MatchStrength _matchStrength;
     protected DataFormatMatcher(InputStream inbyte[] buffered,
             int bufferedStartint bufferedLength,
             JsonFactory matchMatchStrength strength)
          = in;
          = buffered;
          = bufferedStart;
          = bufferedLength;
          = match;
          = strength;
     /* Public API, simple accessors

Accessor to use to see if any formats matched well enough with the input data.
     public boolean hasMatch() { return  != null; }

Method for accessing strength of the match, if any; if no match, will return MatchStrength.INCONCLUSIVE.
     public MatchStrength getMatchStrength() {
         return ( == null) ? . : ;

Accessor for com.fasterxml.jackson.core.JsonFactory that represents format that data matched.
     public JsonFactory getMatch() { return ; }

Accessor for getting brief textual name of matched format if any (null if none). Equivalent to:
   return hasMatch() ? getMatch().getFormatName() : null;
     public String getMatchedFormatName() {
         return .getFormatName();
     /* Public API, factory methods
Convenience method for trying to construct a com.fasterxml.jackson.core.JsonParser for parsing content which is assumed to be in detected data format. If no match was found, returns null.
    public JsonParser createParserWithMatch() throws IOException {
        if ( == null) {
            return null;
        if ( == null) {
        return .createJsonParser(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 InputStream getDataStream() {
        if ( == null) {
            return new ByteArrayInputStream();
        return new MergedStream(null);
New to GrepCode? Check out our FAQ X