Class DefaultCharInputReader
java.lang.Object
com.univocity.parsers.common.input.AbstractCharInputReader
com.univocity.parsers.common.input.DefaultCharInputReader
- All Implemented Interfaces:
CharInput,CharInputReader
A default CharInputReader which only loads batches of characters when requested by the
AbstractCharInputReader through the reloadBuffer() method.-
Field Summary
FieldsFields inherited from class com.univocity.parsers.common.input.AbstractCharInputReader
buffer, closeOnStop, i, length, whitespaceRangeStart -
Constructor Summary
ConstructorsConstructorDescriptionDefaultCharInputReader(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
Modifier and TypeMethodDescriptionvoidCopies a sequence of characters from the input into theAbstractCharInputReader.buffer, and updates theAbstractCharInputReader.lengthto the number of characters read.protected voidPasses 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
-
Field Details
-
reader
-
unwrapping
private boolean unwrapping
-
-
Constructor Details
-
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 Details
-
stop
public void stop()Description copied from interface:CharInputReaderStops the CharInputReader from reading characters from theReaderprovided inCharInputReader.start(Reader)and closes it. -
setReader
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
-