de.esprit.appsuite.database.io

## Class UnlRecordTokenizer

- java.lang.Object
- - de.esprit.appsuite.database.io.UnlRecordTokenizer

-     public class UnlRecordTokenizer
      extends java.lang.Object

  This class tokenizes a single UNL input line and creates a DBObject of the master type from it.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnlRecordTokenizer(DBRecord master)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `char` | `getFieldSeparator()` Returns the field separator character.
    `static void` | `main(java.lang.String[] args)`
    `DBObject` | `parseRecord(java.lang.String inputLine)` Parses the given input line and creates a DBObject of it.
    `void` | `setFieldSeparator(char fs)` Sets the field separator character which is used for tokenizing the input line
    `static java.sql.Date` | `toDate(java.lang.String str)` Creates a Date object from the given String.
    `static java.lang.String` | `toEscapedString(java.lang.String str, char fieldSep)` Converts a String such that special characters are quoted with a backslash.
    `static java.sql.Time` | `toTime(java.lang.String str)` Creates a Time object from the given String.
    `static java.sql.Timestamp` | `toTimestamp(java.lang.String str)` Creates a Timestamp object from the given String.
    `static java.lang.String` | `toUnescapedString(java.lang.String str, char fieldSep)` Converts a String such that backslashes are removed from quoted special characters.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UnlRecordTokenizer

          public UnlRecordTokenizer(DBRecord master)

  - ### Method Detail

    - #### setFieldSeparator

          public void setFieldSeparator(char fs)

      Sets the field separator character which is used for tokenizing the input line

    - #### getFieldSeparator

          public char getFieldSeparator()

      Returns the field separator character. The default field separator is '|'.

    - #### parseRecord

          public DBObject parseRecord(java.lang.String inputLine)
                               throws java.lang.Exception

      Parses the given input line and creates a DBObject of it.
      Parameters:
        `inputLine` - The input line that represents a single record - usually read from a file
      Returns:
        The DBObject of the master type filled with values
      Throws:
        `java.lang.Exception` - if parsing fails

    - #### toDate

          public static java.sql.Date toDate(java.lang.String str)
                                      throws java.lang.Exception

      Creates a Date object from the given String. Various date formats are tested until it succeeds.
      Throws:
        `java.lang.Exception`

    - #### toTime

          public static java.sql.Time toTime(java.lang.String str)
                                      throws java.lang.Exception

      Creates a Time object from the given String.
      Throws:
        `java.lang.Exception`

    - #### toTimestamp

          public static java.sql.Timestamp toTimestamp(java.lang.String str)
                                                throws java.lang.Exception

      Creates a Timestamp object from the given String.
      Throws:
        `java.lang.Exception`

    - #### toEscapedString

          public static java.lang.String toEscapedString(java.lang.String str,
                                         char fieldSep)

      Converts a String such that special characters are quoted with a backslash.

    - #### toUnescapedString

          public static java.lang.String toUnescapedString(java.lang.String str,
                                           char fieldSep)

      Converts a String such that backslashes are removed from quoted special characters.

    - #### main

          public static void main(java.lang.String[] args)

Copyright © 2014 EsprIT-Systems. All Rights Reserved.