de.esprit.appsuite.database.io

## Class DBOUnlReader

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

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

      public class DBOUnlReader
      extends java.lang.Object
      implements java.io.Closeable

  This class reads UNL formatted input and creates DBObjects of the given master type from it.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DBOUnlReader(DBObject master, java.io.BufferedReader reader)`
    `DBOUnlReader(DBObject master, java.io.File file)`
    `DBOUnlReader(DBObject master, java.lang.String fname)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the input file or stream
    `int` | `getErrorCount()` Returns the number of parsing errors that have occurred
    `char` | `getFieldSeparator()` Returns the field separator character.
    `java.lang.String` | `getLastInputLine()` Returns the last processed UNL input line.
    `int` | `getLineCount()` Returns the current line count
    `int` | `getRecordCount()` Returns the number of DBObjects that have been created successfully
    `java.io.File` | `getViolationFile()`
    `boolean` | `hasNext()` Reads the next input line and converts it into an DBObject
    `DBObject` | `next()` Returns the last read DBObject read from the input
    `void` | `setFieldSeparator(char sep)` Sets the field separator character which is used for tokenizing the input line
    `void` | `setViloationFile(java.io.File vioFile)` Sets the violation output file.
    `void` | `setViloationFile(java.lang.String vioFileName)` Sets the violation output file.

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

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

- - ### Constructor Detail

    - #### DBOUnlReader

          public DBOUnlReader(DBObject master,
                      java.lang.String fname)
                       throws java.io.FileNotFoundException

      Throws:
        `java.io.FileNotFoundException`

    - #### DBOUnlReader

          public DBOUnlReader(DBObject master,
                      java.io.File file)
                       throws java.io.FileNotFoundException

      Throws:
        `java.io.FileNotFoundException`

    - #### DBOUnlReader

          public DBOUnlReader(DBObject master,
                      java.io.BufferedReader reader)

  - ### Method Detail

    - #### setFieldSeparator

          public void setFieldSeparator(char sep)

      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 '|'.

    - #### getLastInputLine

          public java.lang.String getLastInputLine()

      Returns the last processed UNL input line. You may want to access this String for instance if a parsing error occurred.

    - #### hasNext

          public boolean hasNext()
                          throws java.lang.Exception

      Reads the next input line and converts it into an DBObject
      Returns:
        true as long as new records are available
      Throws:
        `java.lang.Exception` - if an SQL error occurred

    - #### next

          public DBObject next()

      Returns the last read DBObject read from the input

    - #### close

          public void close()
                     throws java.io.IOException

      Closes the input file or stream
      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Throws:
        `java.io.IOException`

    - #### getLineCount

          public int getLineCount()

      Returns the current line count

    - #### getRecordCount

          public int getRecordCount()

      Returns the number of DBObjects that have been created successfully

    - #### getErrorCount

          public int getErrorCount()

      Returns the number of parsing errors that have occurred

    - #### setViloationFile

          public void setViloationFile(java.lang.String vioFileName)
                                throws java.io.FileNotFoundException

      Sets the violation output file. All non parsable records are written to this file including an appropriate error message telling the cause for failure.
      Throws:
        `java.io.FileNotFoundException`

    - #### setViloationFile

          public void setViloationFile(java.io.File vioFile)
                                throws java.io.FileNotFoundException

      Sets the violation output file. All non parsable records are written to this file including an appropriate error message telling the cause for failure.
      Throws:
        `java.io.FileNotFoundException`

    - #### getViolationFile

          public java.io.File getViolationFile()

Copyright © 2014 EsprIT-Systems. All Rights Reserved.