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 theAbstractCharInputReader
through thereloadBuffer()
method.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Reader
reader
private boolean
unwrapping
-
Fields inherited from class com.univocity.parsers.common.input.AbstractCharInputReader
buffer, closeOnStop, i, length, whitespaceRangeStart
-
-
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 void
reloadBuffer()
Copies a sequence of characters from the input into theAbstractCharInputReader.buffer
, and updates theAbstractCharInputReader.length
to the number of characters read.protected void
setReader(java.io.Reader reader)
Passes theReader
provided in theAbstractCharInputReader.start(Reader)
method to the extending class so it can begin loading characters from it.void
stop()
Stops the CharInputReader from reading characters from theReader
provided 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:CharInputReader
Stops the CharInputReader from reading characters from theReader
provided inCharInputReader.start(Reader)
and closes it.
-
setReader
protected void setReader(java.io.Reader reader)
Description copied from class:AbstractCharInputReader
Passes theReader
provided in theAbstractCharInputReader.start(Reader)
method to the extending class so it can begin loading characters from it.- Specified by:
setReader
in classAbstractCharInputReader
- Parameters:
reader
- theReader
provided inAbstractCharInputReader.start(Reader)
-
reloadBuffer
public void reloadBuffer()
Copies a sequence of characters from the input into theAbstractCharInputReader.buffer
, and updates theAbstractCharInputReader.length
to the number of characters read.- Specified by:
reloadBuffer
in classAbstractCharInputReader
-
-