Class StructuredSchemaReader


  • public class StructuredSchemaReader
    extends Object
    Parser for text file schemas written in Pervasive DataIntegrator structured schema (.schema) format. The parser produces schema objects usable with the structured text file operators in the DataRush library.
    • Method Detail

      • setStringHandling

        public void setStringHandling​(TextTypes.StringConversion handling)
        Configures the string conversion properties of the reader.
        Parameters:
        handling - the conversion policies to use
      • setCharEncoding

        public void setCharEncoding​(CharsetEncoding encoding)
        Configures the character set encoding of the reader.
        Parameters:
        encoding - the character set encoding to use
      • parse

        public TextSchema parse​(String schemaResource)
        Parse the given schema file. A collection of schema objects is created.
        Parameters:
        schemaResource - the name of a file containing a structured schema
        Returns:
        a schema object representing the one described in the source file
        Throws:
        DRException - thrown if any I/O or parser error occurs
      • parseString

        public TextSchema parseString​(String schemaString)
        Parse the given schema string. A collection of schema objects is created.
        Parameters:
        schemaString - the name of a string containing a structured schema
        Returns:
        a schema object representing the one described in the source string
        Throws:
        DRException - thrown if any I/O or parser error occurs
      • loadString

        public static TextSchema loadString​(String schemaString)
        Gets the text schema defined in the specified structured schema string.
        Parameters:
        schemaString - the string to load
        Returns:
        the defined schema
      • load

        public static TextSchema load​(String schemaFile)
        Gets the text schema defined in the specified structured schema file. String valued fields will not trim leading and trailing whitespace and the empty string will be interpreted as a null value.
        Parameters:
        schemaFile - the file to load
        Returns:
        the defined schema
      • load

        public static TextSchema load​(String schemaFile,
                                      TextTypes.StringConversion stringHandling)
        Gets the text schema defined in the specified structured schema file, providing hints about how string valued fields should be interpreted.
        Parameters:
        schemaFile - the file to load
        stringHandling - the string conversion policies to use whitespace removed
        Returns:
        the defined schema
      • load

        public static TextSchema load​(String schemaFile,
                                      TextTypes.StringConversion stringHandling,
                                      CharsetEncoding charEncoding)
        Gets the text schema defined in the specified structured schema file, providing hints about how string valued fields should be interpreted and the character encoding of the file.
        Parameters:
        schemaFile - the file to load
        stringHandling - the string conversion policies to use
        charEncoding - the character set encoding
        Returns:
        the defined schema