Class DataFormatReaders.Match

  • Enclosing class:
    DataFormatReaders

    public static class DataFormatReaders.Match
    extends java.lang.Object
    Result class, similar to DataFormatMatcher
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected byte[] _bufferedData
      Content read during format matching process
      protected int _bufferedLength
      Number of bytes available in buffer.
      protected int _bufferedStart
      Pointer to the first byte in buffer available for reading
      protected ObjectReader _match
      Factory that produced sufficient match (if any)
      protected com.fasterxml.jackson.core.format.MatchStrength _matchStrength
      Strength of match with _match
      protected java.io.InputStream _originalStream  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Match​(java.io.InputStream in, byte[] buffered, int bufferedStart, int bufferedLength, ObjectReader match, com.fasterxml.jackson.core.format.MatchStrength strength)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.fasterxml.jackson.core.JsonParser createParserWithMatch()
      Convenience method for trying to construct a JsonParser for parsing content which is assumed to be in detected data format.
      java.io.InputStream getDataStream()
      Method to use for accessing input for which format detection has been done.
      java.lang.String getMatchedFormatName()
      Accessor for getting brief textual name of matched format if any (null if none).
      com.fasterxml.jackson.core.format.MatchStrength getMatchStrength()
      Method for accessing strength of the match, if any; if no match, will return MatchStrength.INCONCLUSIVE.
      ObjectReader getReader()
      Accessor for JsonFactory that represents format that data matched.
      boolean hasMatch()
      Accessor to use to see if any formats matched well enough with the input data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _originalStream

        protected final java.io.InputStream _originalStream
      • _bufferedData

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

        protected final int _bufferedStart
        Pointer to the first byte in buffer available for reading
      • _bufferedLength

        protected final int _bufferedLength
        Number of bytes available in buffer.
      • _match

        protected final ObjectReader _match
        Factory that produced sufficient match (if any)
      • _matchStrength

        protected final com.fasterxml.jackson.core.format.MatchStrength _matchStrength
        Strength of match with _match
    • Constructor Detail

      • Match

        protected Match​(java.io.InputStream in,
                        byte[] buffered,
                        int bufferedStart,
                        int bufferedLength,
                        ObjectReader match,
                        com.fasterxml.jackson.core.format.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 com.fasterxml.jackson.core.format.MatchStrength getMatchStrength()
        Method for accessing strength of the match, if any; if no match, will return MatchStrength.INCONCLUSIVE.
      • getReader

        public ObjectReader getReader()
        Accessor for JsonFactory that represents format that data matched.
      • getMatchedFormatName

        public java.lang.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 com.fasterxml.jackson.core.JsonParser createParserWithMatch()
                                                                    throws java.io.IOException
        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:
        java.io.IOException
      • getDataStream

        public java.io.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.