de.esprit.appsuite.nio.ascii

## Class AsciiParser<C extends ApplicationContext>

- 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<C>

- All Implemented Interfaces:
    ApplicationObject<C>, AsyncExecutable<C>, CancellableTask, TaskMonitorSupport, SimpleLogSupport, Dumpable, Executable, java.io.Closeable, java.lang.AutoCloseable
  Direct Known Subclasses:
    NdfParser

      public class AsciiParser<C extends ApplicationContext>
      extends AbstractAsciiParser<C,AsciiLine>

  Runs the `AbstractAsciiParser` with a `AsciiLine` and thus provides support for break-characters and block-comments.
  Author:
    Thomas Stecher, Rainer Buesch

- - ### Field Summary

    - ### 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`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AsciiParser(C ctx, java.io.File file)`
    `AsciiParser(C ctx, FileInfo fileInfo, java.io.InputStream stream)`
    `AsciiParser(C ctx, FileInfo fileInfo, java.io.InputStream stream, int buffSize)`
    `AsciiParser(C ctx, java.io.File file, int buffSize)`
    `AsciiParser(C ctx, ProgressFileInputStream progressStream)`
    `AsciiParser(C ctx, ProgressFileInputStream progressStream, int buffSize)`
    `AsciiParser(C ctx, ProgressInputStream progressStream)`
    `AsciiParser(C ctx, ProgressInputStream progressStream, int buffSize)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected AsciiLine` | `createAsciiLine(byte[] data)` Creates the required type of `AsciiLine` for this parser.
    `AsciiLine` | `getNextLine()` Fetches the next line into buffer
    `AsciiLine` | `nextLine()` Fetches the next line into buffer and returns it.
    `AsciiWord` | `nextWord()` Fetches the next word, whereas break-characters and block-comments are returned as single words by their own.
    `void` | `setBlockCommentChar(java.lang.Character blockCommentChar)` Sets the block comment character.
    `byte[]` | `setBreakCodes(byte[] codes)` Sets additional word break-characters which are used as word boundaries but unlike white spaces they are returned as a word by their own.

    - ### 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, performRead, 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`

- - ### Constructor Detail

    - #### AsciiParser

          public AsciiParser(C ctx,
                     java.io.File file,
                     int buffSize)

    - #### AsciiParser

          public AsciiParser(C ctx,
                     java.io.File file)

    - #### AsciiParser

          public AsciiParser(C ctx,
                     FileInfo fileInfo,
                     java.io.InputStream stream,
                     int buffSize)

    - #### AsciiParser

          public AsciiParser(C ctx,
                     FileInfo fileInfo,
                     java.io.InputStream stream)

    - #### AsciiParser

          public AsciiParser(C ctx,
                     ProgressFileInputStream progressStream,
                     int buffSize)

    - #### AsciiParser

          public AsciiParser(C ctx,
                     ProgressFileInputStream progressStream)

    - #### AsciiParser

          public AsciiParser(C ctx,
                     ProgressInputStream progressStream,
                     int buffSize)

    - #### AsciiParser

          public AsciiParser(C ctx,
                     ProgressInputStream progressStream)

  - ### Method Detail

    - #### createAsciiLine

          protected AsciiLine createAsciiLine(byte[] data)

      Description copied from class: `AbstractAsciiParser`
      Creates the required type of `AsciiLine` for this parser.
      Specified by:
        `createAsciiLine` in class `AbstractAsciiParser<C extends ApplicationContext,AsciiLine>`

    - #### nextLine

          public final AsciiLine nextLine()
                                   throws java.io.IOException

      Description copied from class: `AbstractAsciiParser`
      Fetches the next line into buffer and returns it.
      Overrides:
        `nextLine` in class `AbstractAsciiParser<C extends ApplicationContext,AsciiLine>`
      Throws:
        `java.io.EOFException` - if EOF is reached
        `java.io.IOException`

    - #### getNextLine

          public final AsciiLine getNextLine()
                                      throws java.io.IOException

      Description copied from class: `AbstractAsciiParser`
      Fetches the next line into buffer
      Overrides:
        `getNextLine` in class `AbstractAsciiParser<C extends ApplicationContext,AsciiLine>`
      Returns:
        null if EOF is reached
      Throws:
        `java.io.IOException`

    - #### setBlockCommentChar

          public final void setBlockCommentChar(java.lang.Character blockCommentChar)

      Sets the block comment character. If set to null, then block comments are disabled.
      The default block comment character is '$'.

    - #### setBreakCodes

          public byte[] setBreakCodes(byte[] codes)

      Sets additional word break-characters which are used as word boundaries but unlike white spaces they are returned as a word by their own. Typical break-characters could be ',;='. By default they are set to null. Returns the previously set break codes.

    - #### nextWord

          public final AsciiWord nextWord()
                                   throws java.io.IOException

      Fetches the next word, whereas break-characters and block-comments are returned as single words by their own.
      Overrides:
        `nextWord` in class `AbstractAsciiParser<C extends ApplicationContext,AsciiLine>`
      Throws:
        `java.io.IOException` - if EOF is reached

Copyright © 2014 EsprIT-Systems. All Rights Reserved.