public abstract class AbstractAsciiParser<C extends ApplicationContext,L extends SimpleAsciiLine> extends AbstractAsyncExecutable<C> implements java.io.Closeable
ByteBuffer for reading the
file line by line. just by setting markers in the buffer. Thus no new objects are created at all unless data is
actually fetched for evaluation.| Modifier and Type | Field and Description |
|---|---|
protected L |
currentLine |
static int |
DEFAULT_BUFF_SIZE |
childTaskRef, isTestMode, monitorController, resultRef, stateFlag| Modifier | Constructor and Description |
|---|---|
|
AbstractAsciiParser(C ctx,
java.io.File file) |
|
AbstractAsciiParser(C ctx,
FileInfo fileInfo,
java.io.InputStream stream) |
|
AbstractAsciiParser(C ctx,
FileInfo fileInfo,
java.io.InputStream stream,
int buffSize) |
protected |
AbstractAsciiParser(C ctx,
java.io.File file,
int buffSize) |
|
AbstractAsciiParser(C ctx,
ProgressFileInputStream progressStream) |
|
AbstractAsciiParser(C ctx,
ProgressFileInputStream progressStream,
int buffSize) |
|
AbstractAsciiParser(C ctx,
ProgressInputStream progressStream) |
|
AbstractAsciiParser(C ctx,
ProgressInputStream progressStream,
int buffSize) |
| Modifier and Type | Method and Description |
|---|---|
protected byte |
checkedByte(java.lang.Character c) |
void |
close()
Closes the channel
|
protected abstract L |
createAsciiLine(byte[] data)
Creates the required type of
AsciiLine for this parser. |
protected java.io.FileInputStream |
createFileInputStream(java.io.File file) |
void |
executeAsync()
Contains the code to be executed asynchronously.
|
AsciiWord |
getCurrentWord() |
FileInfo |
getFileInfo() |
int |
getLineNumber()
Returns the number of lines read so far.
|
L |
getNextLine()
Fetches the next line into buffer
|
AsciiWord |
getNextWord()
Get next word
|
long |
getReadByteCount()
Returns the number of bytes read so far.
|
int |
getReadOperationCount()
Returns the number of IO read operations that have been made so far.
|
AsciiWord |
getRestOfLine()
Returns the rest from the end of the last word to the end of the line
|
double |
nextDouble() |
int |
nextInt() |
L |
nextLine()
Fetches the next line into buffer and returns it.
|
long |
nextLong() |
short |
nextShort() |
java.lang.String |
nextString() |
AsciiWord |
nextWord()
Fetches the next word of the current line.
|
void |
openFile()
Opens the file channel, if not open yet.
|
protected void |
performRead() |
void |
setLineCommentChar(java.lang.Character lineCommentChar)
Sets the line comment character.
|
void |
skipLines(long count) |
void |
skipRestOfLine() |
void |
skipWords(long count) |
addMonitor, checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, executeSubTask, executeSync, 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, wasCancelledgetApplicationConfig, getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetApplicationContextgetLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelpublic static final int DEFAULT_BUFF_SIZE
protected final L extends SimpleAsciiLine currentLine
public AbstractAsciiParser(C ctx, java.io.File file)
protected AbstractAsciiParser(C ctx, java.io.File file, int buffSize)
public AbstractAsciiParser(C ctx, ProgressInputStream progressStream)
public AbstractAsciiParser(C ctx, ProgressInputStream progressStream, int buffSize)
public AbstractAsciiParser(C ctx, FileInfo fileInfo, java.io.InputStream stream)
public AbstractAsciiParser(C ctx, ProgressFileInputStream progressStream)
public AbstractAsciiParser(C ctx, ProgressFileInputStream progressStream, int buffSize)
protected abstract L createAsciiLine(byte[] data)
AsciiLine for this parser.public final void openFile()
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionprotected final byte checkedByte(java.lang.Character c)
public final void setLineCommentChar(java.lang.Character lineCommentChar)
public final FileInfo getFileInfo()
public final int getLineNumber()
public final long getReadByteCount()
public final int getReadOperationCount()
protected void performRead()
throws java.lang.Exception
java.lang.Exceptionprotected java.io.FileInputStream createFileInputStream(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic final void executeAsync()
throws java.lang.Exception
AsyncExecutableRunnable.run() for async execution.executeAsync in interface AsyncExecutable<C extends ApplicationContext>java.lang.Exceptionfor synchronous executionpublic final java.lang.String nextString()
throws java.io.IOException
java.io.IOExceptionpublic final short nextShort()
throws java.io.IOException
java.io.IOExceptionpublic final int nextInt()
throws java.io.IOException
java.io.IOExceptionpublic final long nextLong()
throws java.io.IOException
java.io.IOExceptionpublic final double nextDouble()
throws java.io.IOException
java.io.IOExceptionpublic final AsciiWord getCurrentWord()
public final AsciiWord getNextWord() throws java.io.IOException
java.io.IOExceptionpublic AsciiWord nextWord() throws java.io.IOException
java.io.IOException - if EOF is reachedpublic final AsciiWord getRestOfLine()
public final void skipRestOfLine()
public final void skipLines(long count)
throws java.io.IOException
java.io.IOExceptionpublic final void skipWords(long count)
throws java.io.IOException
java.io.IOExceptionpublic L nextLine() throws java.io.IOException
java.io.EOFException - if EOF is reachedjava.io.IOExceptionpublic L getNextLine() throws java.io.IOException
java.io.IOExceptionpublic final void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableCopyright © 2011 EsprIT-Systems. All Rights Reserved.