de.esprit.appsuite.nio.ndf

## Class NdfParser

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.appsuite.task.AbstractAsyncExecutable<C>
      - - de.esprit.appsuite.nio.ascii.AbstractAsciiParser<C,AsciiLine>
        - - de.esprit.appsuite.nio.ascii.AsciiParser<ApplicationContext>
          - - de.esprit.appsuite.nio.ndf.NdfParser

- All Implemented Interfaces:
    ApplicationObject<ApplicationContext>, NdfConstants, NdfParseControl, AsyncExecutable<ApplicationContext>, CancellableTask, TaskMonitorSupport, SimpleLogSupport, Dumpable, Executable, java.io.Closeable, java.lang.AutoCloseable

      public final class NdfParser
      extends AsciiParser<ApplicationContext>
      implements NdfConstants, NdfParseControl

  This parser reads ASCII data stored in the Neutral Data Format (NDF). During read it notifies it's `NdfHandler` about every structure and property it has found in the NDF source file. Note that NDF data is read in streaming mode such that not much memory is needed during parsing. It is the job of the attached custom `NdfHandler` to interpret and collect the data.
  Author:
    Rainer Buesch

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected NdfProperties` | `headerProps`

    - ### Fields inherited from class de.esprit.appsuite.nio.ascii.AbstractAsciiParser

      `currentLine, DEFAULT_BUFF_SIZE`

    - ### Fields inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `childTaskRef, isTestMode, monitorController, resultRef, stateFlag`

    - ### Fields inherited from interface de.esprit.appsuite.nio.ndf.NdfConstants

      `allowedInNames, blockCommentChar, booleanFalseChar, booleanFalseLiteral, booleanTrueChar, booleanTrueLiteral, currentNdfDocVersion, defaultTextEndChar, defaultTextParagraphChar, lineCommentChar, ndfDocAuthorKey, ndfDocCreatedKey, ndfDocEncodingKey, ndfDocTypeKey, ndfDocVersionKey, nullLiteral, quotingBreakCodes, standardBreakCodes, structureChar, textValueBreakCodes, validTextBreakSymbols`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NdfParser(ApplicationContext ctx, FileInfo fileInfo, java.io.InputStream stream, NdfHandler handler)`
    `NdfParser(ApplicationContext ctx, FileInfo fileInfo, java.io.InputStream stream, NdfHandler handler, int buffSize)`
    `NdfParser(ApplicationContext ctx, java.io.File file, NdfHandler handler)`
    `NdfParser(ApplicationContext ctx, java.io.File file, NdfHandler handler, int buffSize)`
    `NdfParser(ApplicationContext ctx, ProgressFileInputStream progressStream, NdfHandler handler)`
    `NdfParser(ApplicationContext ctx, ProgressInputStream progressStream, NdfHandler handler)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCurrentNestingLevel()` Returns the current nesting level.
    `NdfStructure` | `getCurrentStructure()` Returns the current structure in process.
    `int` | `getMaxNestingLevel()` Returns the deepest nesting level reached so far during parsing the document.
    `long` | `getParseDuration()` Returns the parsing duration in millis after parsing has been executed.
    `protected void` | `performRead()`
    `void` | `setNotifyAllProperties(boolean notifyAll)` By default only properties on top level are notified because all other properties obtain to particular structures.

    - ### Methods inherited from class de.esprit.appsuite.nio.ascii.AsciiParser

      `createAsciiLine, getNextLine, nextLine, nextWord, setBlockCommentChar, setBreakCodes`

    - ### Methods inherited from class de.esprit.appsuite.nio.ascii.AbstractAsciiParser

      `checkedByte, close, createFileInputStream, executeAsync, getCurrentToRestOfLine, getCurrentWord, getFileInfo, getLineNumber, getNextWord, getReadByteCount, getReadOperationCount, getRestOfLine, isEndOfLineReached, nextDouble, nextInt, nextLong, nextShort, nextString, openFile, setEncoding, setLineCommentChar, skipLines, skipRestOfLine, skipWords`

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `addMonitor, checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, handleFinish, handleStart, handleSuccess, hasError, hasMonitor, isCancellable, notifyProceeded, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelled`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toString`

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

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

    - ### Methods inherited from interface de.esprit.appsuite.launch.ApplicationObject

      `getApplicationContext`

    - ### Methods inherited from interface de.esprit.common.log.SimpleLogSupport

      `getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

- - ### Field Detail

    - #### headerProps

          protected NdfProperties headerProps

  - ### Constructor Detail

    - #### NdfParser

          public NdfParser(ApplicationContext ctx,
                   java.io.File file,
                   NdfHandler handler)
                    throws java.io.FileNotFoundException

      Throws:
        `java.io.FileNotFoundException`

    - #### NdfParser

          public NdfParser(ApplicationContext ctx,
                   java.io.File file,
                   NdfHandler handler,
                   int buffSize)
                    throws java.io.FileNotFoundException

      Throws:
        `java.io.FileNotFoundException`

    - #### NdfParser

          public NdfParser(ApplicationContext ctx,
                   ProgressInputStream progressStream,
                   NdfHandler handler)

    - #### NdfParser

          public NdfParser(ApplicationContext ctx,
                   ProgressFileInputStream progressStream,
                   NdfHandler handler)

    - #### NdfParser

          public NdfParser(ApplicationContext ctx,
                   FileInfo fileInfo,
                   java.io.InputStream stream,
                   NdfHandler handler)

    - #### NdfParser

          public NdfParser(ApplicationContext ctx,
                   FileInfo fileInfo,
                   java.io.InputStream stream,
                   NdfHandler handler,
                   int buffSize)

  - ### Method Detail

    - #### setNotifyAllProperties

          public void setNotifyAllProperties(boolean notifyAll)

      By default only properties on top level are notified because all other properties obtain to particular structures. Setting this flag causes `NdfHandler.foundProperties(NdfStructure, NdfProperties)` to be called for all properties no matter on which nesting level they were found.

    - #### getCurrentStructure

          public NdfStructure getCurrentStructure()

      Description copied from interface: `NdfParseControl`
      Returns the current structure in process.
      Specified by:
        `getCurrentStructure` in interface `NdfParseControl`

    - #### getCurrentNestingLevel

          public int getCurrentNestingLevel()

      Description copied from interface: `NdfParseControl`
      Returns the current nesting level. This level increases each time an OBJECT structure contains another structure. It decreases when parsing of the sub-structure is done.
      Specified by:
        `getCurrentNestingLevel` in interface `NdfParseControl`

    - #### getMaxNestingLevel

          public int getMaxNestingLevel()

      Description copied from interface: `NdfParseControl`
      Returns the deepest nesting level reached so far during parsing the document.
      Specified by:
        `getMaxNestingLevel` in interface `NdfParseControl`

    - #### getParseDuration

          public long getParseDuration()

      Returns the parsing duration in millis after parsing has been executed.

    - #### performRead

          protected final void performRead()
                                    throws java.lang.Exception

      Overrides:
        `performRead` in class `AbstractAsciiParser<ApplicationContext,AsciiLine>`
      Throws:
        `java.lang.Exception`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.