Class FormatDetector


  • public class FormatDetector
    extends Object
    Provides a means to analyze content to determine what Format the data is represented as.
    • Constructor Detail

      • FormatDetector

        public FormatDetector()
        Construct a new format detector using the default configuration.
      • FormatDetector

        public FormatDetector​(@NonNull
                              IConfiguration<DeserializationFeature<?>> configuration)
        Construct a new format detector using the provided configuration.
        Parameters:
        configuration - the deserialization configuration to use for detection
      • FormatDetector

        protected FormatDetector​(@NonNull
                                 IConfiguration<DeserializationFeature<?>> configuration,
                                 @NonNull
                                 com.fasterxml.jackson.core.JsonFactory... detectors)
        Construct a new format detector using the provided configuration.
        Parameters:
        configuration - the deserialization configuration to use for detection
        detectors - the JSON parser instances to use for format detection
    • Method Detail

      • detect

        @NonNull
        public FormatDetector.Result detect​(@NonNull
                                            URL resource)
                                     throws IOException
        Analyzes the provided resource to determine it's format.
        Parameters:
        resource - the resource to analyze
        Returns:
        the analysis result
        Throws:
        IOException - if an error occurred while reading the resource
      • detect

        @NonNull
        public FormatDetector.Result detect​(@NonNull
                                            InputStream inputStream)
                                     throws IOException
        Analyzes the data from the provided inputStream to determine it's format.
        Parameters:
        inputStream - the resource stream to analyze
        Returns:
        the analysis result
        Throws:
        IOException - if an error occurred while reading the resource