Class DataFormatReaders


  • public class DataFormatReaders
    extends java.lang.Object
    Alternative to DataFormatDetector that needs to be used when using data-binding.
    Since:
    2.1
    • Field Detail

      • DEFAULT_MAX_INPUT_LOOKAHEAD

        public static final 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.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DataFormatReaders

        public DataFormatReaders​(ObjectReader... detectors)
      • DataFormatReaders

        public DataFormatReaders​(java.util.Collection<ObjectReader> detectors)
    • Method Detail

      • withMaxInputLookahead

        public DataFormatReaders withMaxInputLookahead​(int lookaheadBytes)
      • findFormat

        public DataFormatReaders.Match findFormat​(java.io.InputStream in)
                                           throws java.io.IOException
        Method to call to find format that content (accessible via given InputStream) given has, as per configuration of this detector instance.
        Returns:
        Matcher object which contains result; never null, even in cases where no match (with specified minimal match strength) is found.
        Throws:
        java.io.IOException
      • findFormat

        public DataFormatReaders.Match findFormat​(byte[] fullInputData)
                                           throws java.io.IOException
        Method to call to find format that given content (full document) has, as per configuration of this detector instance.
        Returns:
        Matcher object which contains result; never null, even in cases where no match (with specified minimal match strength) is found.
        Throws:
        java.io.IOException
      • findFormat

        public DataFormatReaders.Match findFormat​(byte[] fullInputData,
                                                  int offset,
                                                  int len)
                                           throws java.io.IOException
        Method to call to find format that given content (full document) has, as per configuration of this detector instance.
        Returns:
        Matcher object which contains result; never null, even in cases where no match (with specified minimal match strength) is found.
        Throws:
        java.io.IOException
        Since:
        2.1
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object