public abstract class DataParser<C extends ApplicationContext> extends AbstractAsyncExecutable<C> implements java.io.Closeable
AsyncExecutable it may run asynchronously within an
AsyncTask. In async mode it fires 100 progress events per file read.childTaskRef, isTestMode, monitorController, resultRef, stateFlag| Constructor and Description |
|---|
DataParser(C ctx,
java.io.File file) |
DataParser(C ctx,
FileInfo fileInfo) |
DataParser(C ctx,
java.io.File file,
int buffSize) |
DataParser(C ctx,
java.io.InputStream inStream,
FileInfo fileInfo) |
DataParser(C ctx,
LogChannel logCh,
java.io.File file) |
DataParser(C ctx,
LogChannel logCh,
FileInfo fileInfo) |
DataParser(C ctx,
LogChannel logCh,
FileInfo fileInfo,
int buffSize) |
DataParser(C ctx,
LogChannel logCh,
java.io.File file,
int buffSize) |
DataParser(C ctx,
LogChannel logCh,
java.io.InputStream inStream,
FileInfo fileInfo) |
DataParser(C ctx,
LogChannel logCh,
ProgressReader reader) |
DataParser(C ctx,
LogChannel logCh,
ResourceInfo resourceInfo) |
DataParser(C ctx,
LogChannel logCh,
ResourceInfo resourceInfo,
int buffSize) |
DataParser(C ctx,
ProgressReader reader) |
DataParser(C ctx,
ResourceInfo resourceInfo) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected FastStringIterator |
createWordIterator() |
protected void |
doOnFileClosed(FileInfo fileInfo)
Is called after the file has been closed
|
protected void |
doOnFileOpening(FileInfo fileInfo)
Is called when the file is being opened
|
void |
executeAsync()
Contains the code to be executed asynchronously.
|
double |
getAndSkipDouble() |
int |
getAndSkipInt() |
java.lang.String |
getAndSkipToken() |
char |
getBlockCommentChar() |
double |
getCurrentDouble() |
int |
getCurrentInt() |
java.lang.String |
getCurrentKeyword(java.lang.String... keywords)
Returns the current keyword and throws an Exception if it is not one of the given keywords.
|
java.lang.String |
getCurrentLine() |
int |
getCurrentLineIndex() |
long |
getCurrentLong() |
java.lang.String |
getCurrentToken() |
java.lang.String |
getCurrentToRestOfLine() |
FileInfo |
getFileInfo()
May be null if we are reading a system resource
|
long |
getFileSize() |
char |
getLineCommentChar() |
int |
getLineNumber() |
double |
getNextDouble() |
int |
getNextInt() |
java.lang.String |
getNextKeyword(java.lang.String... keywords)
Searches for the next keyword which must be one in the given keywords.
|
long |
getNextLong() |
java.lang.String |
getNextToken() |
java.lang.String |
getNextToRestOfLine() |
int |
getReadPercentage() |
int |
getReadTokenCount() |
java.lang.String |
getRestOfLine() |
boolean |
hasNext() |
protected ProgressReader |
openStream() |
protected abstract void |
performRead() |
java.lang.String |
readLine() |
void |
setBlockCommentChar(char blockCommentChar) |
void |
setLineCommentChar(char lineCommentChar) |
void |
setSkipCommentBlocks(boolean isSkipCommentBlocks) |
void |
setSkipCommentLines(boolean isSkip) |
void |
setSkipEmptyLines(boolean isSkip) |
void |
skipAll()
Stops any further parsing of input data.
|
void |
skipCheckedMatchingCurrentToken(java.lang.String token)
Forwards to the next token if the current token matches the given token.
|
void |
skipLine()
Moves one line forward
|
void |
skipLines(long numLines)
Moves numLines forward
|
boolean |
skipMatchingCurrentToken(java.lang.String token)
Forwards to the next token if the current token matches the given token.
|
void |
skipRestOfLine()
Moves to the end of line and resets the currentToken to null.
|
void |
skipToken() |
void |
skipTokens(long wordCnt) |
void |
skipToKeyword(java.lang.String keyword)
Moves to the next word that matches the given keyword.
|
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, wasCancelledgetApplicationContext, 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 DataParser(C ctx, java.io.File file)
public DataParser(C ctx, java.io.File file, int buffSize)
public DataParser(C ctx, LogChannel logCh, java.io.File file)
public DataParser(C ctx, LogChannel logCh, java.io.File file, int buffSize)
public DataParser(C ctx, LogChannel logCh, FileInfo fileInfo)
public DataParser(C ctx, LogChannel logCh, FileInfo fileInfo, int buffSize)
public DataParser(C ctx, LogChannel logCh, java.io.InputStream inStream, FileInfo fileInfo)
public DataParser(C ctx, ProgressReader reader)
public DataParser(C ctx, LogChannel logCh, ProgressReader reader)
public DataParser(C ctx, ResourceInfo resourceInfo)
public DataParser(C ctx, LogChannel logCh, ResourceInfo resourceInfo)
public DataParser(C ctx, LogChannel logCh, ResourceInfo resourceInfo, int buffSize)
public int getLineNumber()
protected ProgressReader openStream() throws java.lang.Exception
java.lang.Exceptionpublic final void executeAsync()
throws java.lang.Exception
AsyncExecutableRunnable.run() for async execution.executeAsync in interface AsyncExecutable<C extends ApplicationContext>executeAsync in class AbstractAsyncExecutable<C extends ApplicationContext>java.lang.Exceptionfor synchronous executionpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableprotected void doOnFileClosed(FileInfo fileInfo)
protected void doOnFileOpening(FileInfo fileInfo)
protected abstract void performRead()
throws java.lang.Exception
java.lang.Exceptionprotected FastStringIterator createWordIterator()
public void setSkipCommentBlocks(boolean isSkipCommentBlocks)
public char getBlockCommentChar()
public void setBlockCommentChar(char blockCommentChar)
public char getLineCommentChar()
public void setLineCommentChar(char lineCommentChar)
public long getFileSize()
public FileInfo getFileInfo()
public void skipAll()
public boolean skipMatchingCurrentToken(java.lang.String token)
throws java.lang.Exception
getNextToken() call has
been done.java.lang.Exceptionpublic void skipCheckedMatchingCurrentToken(java.lang.String token)
throws java.lang.Exception
java.lang.Exception - if the current token did not match the given tokenpublic void skipRestOfLine()
public void skipLine()
throws java.lang.Exception
java.lang.Exceptionpublic void skipLines(long numLines)
throws java.lang.Exception
java.lang.Exceptionpublic void skipToken()
throws java.lang.Exception
java.lang.Exceptionpublic void skipTokens(long wordCnt)
throws java.lang.Exception
java.lang.Exceptionpublic void skipToKeyword(java.lang.String keyword)
throws java.lang.Exception
java.lang.Exceptionpublic final java.lang.String readLine()
throws java.io.IOException
java.io.IOExceptionpublic int getCurrentLineIndex()
public void setSkipCommentLines(boolean isSkip)
public void setSkipEmptyLines(boolean isSkip)
public java.lang.String getNextKeyword(java.lang.String... keywords)
throws java.lang.Exception
UnexpectedKeywordException - if the next word is not one of the expected keywordsjava.lang.Exceptionpublic java.lang.String getCurrentKeyword(java.lang.String... keywords)
throws java.lang.Exception
UnexpectedKeywordException - if the next word is not one of the expected keywordsjava.lang.Exceptionpublic java.lang.String getCurrentLine()
public java.lang.String getCurrentToken()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getAndSkipToken()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getNextToken()
throws java.lang.Exception
java.lang.Exceptionpublic int getReadTokenCount()
public int getReadPercentage()
public int getCurrentInt()
throws java.lang.Exception
java.lang.Exceptionpublic long getCurrentLong()
throws java.lang.Exception
java.lang.Exceptionpublic int getAndSkipInt()
throws java.lang.Exception
java.lang.Exceptionpublic int getNextInt()
throws java.lang.Exception
java.lang.Exceptionpublic long getNextLong()
throws java.lang.Exception
java.lang.Exceptionpublic double getCurrentDouble()
throws java.lang.Exception
java.lang.Exceptionpublic double getAndSkipDouble()
throws java.lang.Exception
java.lang.Exceptionpublic double getNextDouble()
throws java.lang.Exception
java.lang.Exceptionpublic boolean hasNext()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getRestOfLine()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getNextToRestOfLine()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getCurrentToRestOfLine()
throws java.lang.Exception
java.lang.ExceptionCopyright © 2014 EsprIT-Systems. All Rights Reserved.