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, wasCancelled
getApplicationConfig, getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getApplicationContext
getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
public 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.FileNotFoundException
protected 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.Exception
protected java.io.FileInputStream createFileInputStream(java.io.File file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public final void executeAsync() throws java.lang.Exception
AsyncExecutable
Runnable.run()
for async execution.executeAsync
in interface AsyncExecutable<C extends ApplicationContext>
java.lang.Exception
for synchronous execution
public final java.lang.String nextString() throws java.io.IOException
java.io.IOException
public final short nextShort() throws java.io.IOException
java.io.IOException
public final int nextInt() throws java.io.IOException
java.io.IOException
public final long nextLong() throws java.io.IOException
java.io.IOException
public final double nextDouble() throws java.io.IOException
java.io.IOException
public final AsciiWord getCurrentWord()
public final AsciiWord getNextWord() throws java.io.IOException
java.io.IOException
public 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.IOException
public final void skipWords(long count) throws java.io.IOException
java.io.IOException
public L nextLine() throws java.io.IOException
java.io.EOFException
- if EOF is reachedjava.io.IOException
public L getNextLine() throws java.io.IOException
java.io.IOException
public final void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
Copyright © 2011 EsprIT-Systems. All Rights Reserved.