- 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonTextAnalyzer.JsonAnalysis
Contains the results of the analysis of a json text file.
-
Constructor Summary
Constructors Constructor Description JsonTextAnalyzer()
Creates a new JSON analyzer with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonTextAnalyzer.JsonAnalysis
analyze(Path file, CharsetEncoding charsetSpec)
Analyzes the specified JSON file based on current configuration.JsonTextAnalyzer.JsonAnalysis
analyze(Path file, CharsetEncoding charsetSpec, FileClient client)
Analyzes the specified JSON file based on current configuration.JsonTextAnalyzer.JsonAnalysis
analyze(Reader input)
Analyzes the specified JSON file based on current configuration.JsonTextAnalyzer.JsonAnalysis
analyze(String file, CharsetEncoding charsetSpec)
Analyzes the specified JSON file based on current configuration.void
setAnalysisSize(int count)
Sets the maximum number of characters to use in analysis.void
setJsonParserOptions(boolean[] options)
-
-
-
Method Detail
-
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 analyzecharsetSpec
- 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 analyzecharsetSpec
- 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 analyzecharsetSpec
- description of the file's character set encodingclient
- 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
-
-