Class JsonTextAnalyzer

java.lang.Object
com.pervasive.datarush.operators.io.textfile.JsonTextAnalyzer

public class JsonTextAnalyzer extends Object
An analyzer for files containing JSON text. An analysis performs a basic parsing of the file. After analysis, it provides values of fields for analyzed records. This information can be used to generate a schema for the records. It could also be used to provide a preview of how a file would be parsed with given settings.
  • Constructor Details

    • JsonTextAnalyzer

      public JsonTextAnalyzer()
      Creates a new JSON analyzer with default settings.
  • Method Details

    • setAnalysisSize

      public void setAnalysisSize(int count)
      Sets the maximum number of characters to use in analysis. This value should be large enough to contain at least one records. By default, 1MB is analyzed.
      Parameters:
      count - the number of characters to analyze
    • setJsonParserOptions

      public void setJsonParserOptions(boolean[] options)
    • analyze

      public JsonTextAnalyzer.JsonAnalysis analyze(String file, CharsetEncoding charsetSpec) throws IOException
      Analyzes the specified JSON file based on current configuration.
      Parameters:
      file - path to the delimited text file to analyze
      charsetSpec - description of the file's character set encoding
      Returns:
      an analysis of the JSON text file
      Throws:
      IOException - if an error occurs while reading the file
    • analyze

      public JsonTextAnalyzer.JsonAnalysis analyze(Path file, CharsetEncoding charsetSpec) throws IOException
      Analyzes the specified JSON file based on current configuration.
      Parameters:
      file - path to the delimited text file to analyze
      charsetSpec - description of the file's character set encoding
      Returns:
      an analysis of the JSON text file
      Throws:
      IOException - if an error occurs while reading the file
    • analyze

      public JsonTextAnalyzer.JsonAnalysis analyze(Path file, CharsetEncoding charsetSpec, FileClient client) throws IOException
      Analyzes the specified JSON file based on current configuration.
      Parameters:
      file - path to the delimited text file to analyze
      charsetSpec - description of the file's character set encoding
      client - the authorization context to use for accessing the file
      Returns:
      an analysis of the JSON text file
      Throws:
      IOException - if an error occurs while reading the file
    • analyze

      public JsonTextAnalyzer.JsonAnalysis analyze(Reader input) throws IOException
      Analyzes the specified JSON file based on current configuration.
      Parameters:
      input - the text data to analyze
      Returns:
      an analysis of the JSON text file
      Throws:
      IOException - if an error occurs while reading the file