AbstractCharInputReader when requested.
This class loads "buckets" of characters in the background and provides them sequentially to the ConcurrentCharInputReader#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
| Modifier and Type | Field and Description |
|---|---|
| private ConcurrentCharLoader | |
| private final int | |
| private final int | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | ConcurrentCharInputReader(char
the normalized newline character (as defined in normalizedLineSeparator, int Format#getNormalizedNewline())
that is used to replace any lineSeparator sequence found in the input.the size of an each individual "bucket" used to store characters read from the input. bucketSize, int the number of "buckets" to load in memory. Note the reader will stop if all buckets are full. bucketQuantity, int starting range of characters considered to be whitespace. whitespaceRangeStart, boolean indicates whether to automatically close the input when closeOnStop)stop() is calledCreates a new instance with the mandatory characters for handling newlines transparently. |
| public | ConcurrentCharInputReader(char[]
the sequence of characters that represent a newline, as defined in lineSeparator, char Format#getLineSeparator()the normalized newline character (as defined in normalizedLineSeparator, int Format#getNormalizedNewline())
that is used to replace any lineSeparator sequence found in the input.the size of an each individual "bucket" used to store characters read from the input. bucketSize, int the number of "buckets" to load in memory. Note the reader will stop if all buckets are full. bucketQuantity, int starting range of characters considered to be whitespace. whitespaceRangeStart, boolean indicates whether to automatically close the input when closeOnStop)stop() is calledCreates a new instance with the mandatory characters for handling newlines transparently. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | reloadBuffer()
Implements abstract com. ConcurrentCharInputReader#buffer attribute, and updates the ConcurrentCharInputReader#length to the number of characters read.
|
| protected void | setReader(Reader
the reader)java. provided in AbstractCharInputReader#start(Reader)Implements abstract com. |
| public void | stop()
Implements com. java. provided in ConcurrentCharInputReader#start(Reader) and closes it.
|
| bucketLoader | back to summary |
|---|---|
| private ConcurrentCharLoader bucketLoader | |
| bucketQuantity | back to summary |
|---|---|
| private final int bucketQuantity | |
| bucketSize | back to summary |
|---|---|
| private final int bucketSize | |
| unwrapping | back to summary |
|---|---|
| private boolean unwrapping | |
| ConcurrentCharInputReader | back to summary |
|---|---|
| public ConcurrentCharInputReader(char normalizedLineSeparator, int bucketSize, int bucketQuantity, int whitespaceRangeStart, boolean closeOnStop) Creates a new instance with the mandatory characters for handling newlines transparently. Line separators will be detected automatically.
| |
| ConcurrentCharInputReader | back to summary |
|---|---|
| public ConcurrentCharInputReader(char[] lineSeparator, char normalizedLineSeparator, int bucketSize, int bucketQuantity, int whitespaceRangeStart, boolean closeOnStop) Creates a new instance with the mandatory characters for handling newlines transparently.
| |
| reloadBuffer | back to summary |
|---|---|
| protected void reloadBuffer() Implements abstract com. Assigns the next "bucket" of characters to the
| |
| setReader | back to summary |
|---|---|
| protected void setReader(Reader reader) Implements abstract com. Starts an input reading thread to load characters from the given reader into "buckets" of characters
| |
| stop | back to summary |
|---|---|
| public void stop() Implements com. Stops the CharInputReader from reading characters from the
| |