|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.common.input.AbstractCharInputReader
com.univocity.parsers.common.input.concurrent.ConcurrentCharInputReader
public class ConcurrentCharInputReader
A concurrent CharInputReader that loads batches of characters in a separate thread and assigns them to buffer in AbstractCharInputReader when requested.
This class loads "buckets" of characters in the background and provides them sequentially to the AbstractCharInputReader.buffer
attribute in AbstractCharInputReader.
The bucket loading process will block and wait while all buckets are full.
Similarly, the reader will block while all buckets are empty.
This CharInputReader implementation provides a better throughput than DefaultCharInputReader when reading large inputs (> 100 mb).
CharInputReader,
ConcurrentCharLoader,
CharBucket| Field Summary |
|---|
| Fields inherited from class com.univocity.parsers.common.input.AbstractCharInputReader |
|---|
buffer, i, length |
| Constructor Summary | |
|---|---|
ConcurrentCharInputReader(char[] lineSeparator,
char normalizedLineSeparator,
int bucketSize,
int bucketQuantity,
int whitespaceRangeStart)
Creates a new instance with the mandatory characters for handling newlines transparently. |
|
ConcurrentCharInputReader(char normalizedLineSeparator,
int bucketSize,
int bucketQuantity,
int whitespaceRangeStart)
Creates a new instance with the mandatory characters for handling newlines transparently. |
|
| Method Summary | |
|---|---|
protected void |
reloadBuffer()
Assigns the next "bucket" of characters to the AbstractCharInputReader.buffer attribute, and updates the AbstractCharInputReader.length to the number of characters read. |
protected void |
setReader(Reader reader)
Starts an input reading thread to load characters from the given reader into "buckets" of characters |
void |
stop()
Stops the CharInputReader from reading characters from the Reader provided in AbstractCharInputReader.start(Reader) and closes it. |
| Methods inherited from class com.univocity.parsers.common.input.AbstractCharInputReader |
|---|
addInputAnalysisProcess, charCount, currentParsedContent, enableNormalizeLineEndings, getChar, getLineSeparator, getQuotedString, getString, lineCount, markRecordStart, nextChar, readComment, skipLines, skipWhitespace, start, unwrapInputStream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConcurrentCharInputReader(char normalizedLineSeparator,
int bucketSize,
int bucketQuantity,
int whitespaceRangeStart)
normalizedLineSeparator - the normalized newline character (as defined in Format.getNormalizedNewline())
that is used to replace any lineSeparator sequence found in the input.bucketSize - the size of an each individual "bucket" used to store characters read from the input.bucketQuantity - the number of "buckets" to load in memory. Note the reader will stop if all buckets are full.whitespaceRangeStart - starting range of characters considered to be whitespace.
public ConcurrentCharInputReader(char[] lineSeparator,
char normalizedLineSeparator,
int bucketSize,
int bucketQuantity,
int whitespaceRangeStart)
lineSeparator - the sequence of characters that represent a newline, as defined in Format.getLineSeparator()normalizedLineSeparator - the normalized newline character (as defined in Format.getNormalizedNewline())
that is used to replace any lineSeparator sequence found in the input.bucketSize - the size of an each individual "bucket" used to store characters read from the input.bucketQuantity - the number of "buckets" to load in memory. Note the reader will stop if all buckets are full.whitespaceRangeStart - starting range of characters considered to be whitespace.| Method Detail |
|---|
public void stop()
Reader provided in AbstractCharInputReader.start(Reader) and closes it.
Also stops the input reading thread.
protected void setReader(Reader reader)
setReader in class AbstractCharInputReaderreader - the Reader provided in AbstractCharInputReader.start(Reader)protected void reloadBuffer()
AbstractCharInputReader.buffer attribute, and updates the AbstractCharInputReader.length to the number of characters read.
reloadBuffer in class AbstractCharInputReader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||