Class StructuredSchemaReader

java.lang.Object
com.pervasive.datarush.schema.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 Details

    • 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
    • parse

      public TextSchema parse(String schemaResource, SchemaType type)
      Parse the given schema file as the provided schema type. A collection of schema objects is created.
      Parameters:
      schemaResource - the name of a file containing a structured schema
      type - the type of schema the file should be interpreted as
      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, SchemaType type)
      Parse the given schema string as the provided schema type. A collection of schema objects is created.
      Parameters:
      schemaString - the name of a string containing a structured schema
      type - the type of schema the string should be interpreted as
      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
    • load

      public static TextSchema load(String schemaFile, TextTypes.StringConversion stringHandling, CharsetEncoding charEncoding, SchemaType type)
      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. This method should only be used if the schematype is known in advanced and the provided schema is missing this information.
      Parameters:
      schemaFile - the file to load
      stringHandling - the string conversion policies to use
      charEncoding - the character set encoding
      type - the schema type of the file
      Returns:
      the defined schema