com.univocity.parsers.common.input
Class DefaultCharInputReader

java.lang.Object
  extended by com.univocity.parsers.common.input.AbstractCharInputReader
      extended by 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 the AbstractCharInputReader through the reloadBuffer() method.

Author:
uniVocity Software Pty Ltd - parsers@univocity.com

Field Summary
 
Fields inherited from class com.univocity.parsers.common.input.AbstractCharInputReader
buffer, i, length
 
Constructor Summary
DefaultCharInputReader(char[] lineSeparator, char normalizedLineSeparator, int bufferSize, int whitespaceRangeStart)
          Creates a new instance with the mandatory characters for handling newlines transparently.
DefaultCharInputReader(char normalizedLineSeparator, int bufferSize, int whitespaceRangeStart)
          Creates a new instance with the mandatory characters for handling newlines transparently.
 
Method Summary
 void reloadBuffer()
          Copies a sequence of characters from the input into the AbstractCharInputReader.buffer, and updates the AbstractCharInputReader.length to the number of characters read.
protected  void setReader(Reader reader)
          Passes the Reader provided in the AbstractCharInputReader.start(Reader) method to the extending class so it can begin loading characters from it.
 void stop()
          Stops the CharInputReader from reading characters from the Reader provided in CharInputReader.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

DefaultCharInputReader

public DefaultCharInputReader(char normalizedLineSeparator,
                              int bufferSize,
                              int whitespaceRangeStart)
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 in Format.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.

DefaultCharInputReader

public DefaultCharInputReader(char[] lineSeparator,
                              char normalizedLineSeparator,
                              int bufferSize,
                              int whitespaceRangeStart)
Creates a new instance with the mandatory characters for handling newlines transparently.

Parameters:
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.
bufferSize - the buffer size used to store characters read from the input.
whitespaceRangeStart - starting range of characters considered to be whitespace.
Method Detail

stop

public void stop()
Description copied from interface: CharInputReader
Stops the CharInputReader from reading characters from the Reader provided in CharInputReader.start(Reader) and closes it.


setReader

protected void setReader(Reader reader)
Description copied from class: AbstractCharInputReader
Passes the Reader provided in the AbstractCharInputReader.start(Reader) method to the extending class so it can begin loading characters from it.

Specified by:
setReader in class AbstractCharInputReader
Parameters:
reader - the Reader provided in AbstractCharInputReader.start(Reader)

reloadBuffer

public void reloadBuffer()
Copies a sequence of characters from the input into the AbstractCharInputReader.buffer, and updates the AbstractCharInputReader.length to the number of characters read.

Specified by:
reloadBuffer in class AbstractCharInputReader


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.