Class DefaultCharInputReader
- java.lang.Object
-
- com.univocity.parsers.common.input.AbstractCharInputReader
-
- com.univocity.parsers.common.input.DefaultCharInputReader
-
- All Implemented Interfaces:
CharInput,CharInputReader
public class DefaultCharInputReader extends AbstractCharInputReader
A default CharInputReader which only loads batches of characters when requested by theAbstractCharInputReaderthrough thereloadBuffer()method.- Author:
- Univocity Software Pty Ltd - parsers@univocity.com
-
-
Field Summary
-
Fields inherited from class com.univocity.parsers.common.input.AbstractCharInputReader
buffer, closeOnStop, i, length
-
-
Constructor Summary
Constructors Constructor Description DefaultCharInputReader(char[] lineSeparator, char normalizedLineSeparator, int bufferSize, int whitespaceRangeStart, boolean closeOnStop)Creates a new instance with the mandatory characters for handling newlines transparently.DefaultCharInputReader(char normalizedLineSeparator, int bufferSize, int whitespaceRangeStart, boolean closeOnStop)Creates a new instance with the mandatory characters for handling newlines transparently.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidreloadBuffer()Copies a sequence of characters from the input into theAbstractCharInputReader.buffer, and updates theAbstractCharInputReader.lengthto the number of characters read.protected voidsetReader(java.io.Reader reader)Passes theReaderprovided in theAbstractCharInputReader.start(Reader)method to the extending class so it can begin loading characters from it.voidstop()Stops the CharInputReader from reading characters from theReaderprovided inCharInputReader.start(Reader)and closes it.-
Methods inherited from class com.univocity.parsers.common.input.AbstractCharInputReader
addInputAnalysisProcess, charCount, currentParsedContent, currentParsedContentLength, enableNormalizeLineEndings, getChar, getLineSeparator, getQuotedString, getString, lastIndexOf, lineCount, markRecordStart, nextChar, readComment, skipLines, skipQuotedString, skipString, skipWhitespace, start, unwrapInputStream
-
-
-
-
Constructor Detail
-
DefaultCharInputReader
public DefaultCharInputReader(char normalizedLineSeparator, int bufferSize, int whitespaceRangeStart, boolean closeOnStop)Creates a new instance with the mandatory characters for handling newlines transparently. Line separators will be detected automatically.- Parameters:
normalizedLineSeparator- the normalized newline character (as defined inFormat.getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.bufferSize- the buffer size used to store characters read from the input.whitespaceRangeStart- starting range of characters considered to be whitespace.closeOnStop- indicates whether to automatically close the input whenstop()is called
-
DefaultCharInputReader
public DefaultCharInputReader(char[] lineSeparator, char normalizedLineSeparator, int bufferSize, int whitespaceRangeStart, boolean closeOnStop)Creates a new instance with the mandatory characters for handling newlines transparently.- Parameters:
lineSeparator- the sequence of characters that represent a newline, as defined inFormat.getLineSeparator()normalizedLineSeparator- the normalized newline character (as defined inFormat.getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.bufferSize- the buffer size used to store characters read from the input.whitespaceRangeStart- starting range of characters considered to be whitespace.closeOnStop- indicates whether to automatically close the input whenstop()is called
-
-
Method Detail
-
stop
public void stop()
Description copied from interface:CharInputReaderStops the CharInputReader from reading characters from theReaderprovided inCharInputReader.start(Reader)and closes it.
-
setReader
protected void setReader(java.io.Reader reader)
Description copied from class:AbstractCharInputReaderPasses theReaderprovided in theAbstractCharInputReader.start(Reader)method to the extending class so it can begin loading characters from it.- Specified by:
setReaderin classAbstractCharInputReader- Parameters:
reader- theReaderprovided inAbstractCharInputReader.start(Reader)
-
reloadBuffer
public void reloadBuffer()
Copies a sequence of characters from the input into theAbstractCharInputReader.buffer, and updates theAbstractCharInputReader.lengthto the number of characters read.- Specified by:
reloadBufferin classAbstractCharInputReader
-
-