Top Description Fields Constructors Methods
com.univocity.parsers.common.input

public Class DefaultCharInputReader

extends AbstractCharInputReader
Class Inheritance
Imports
com.univocity.parsers.common.*, java.io.*

A default CharInputReader which only loads batches of characters when requested by the AbstractCharInputReader through the DefaultCharInputReader#reloadBuffer method.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Modifier and TypeField and Description
private Reader
private boolean
Inherited from com.univocity.parsers.common.input.AbstractCharInputReader:
buffercloseOnStopilengthwhitespaceRangeStart

Constructor Summary

AccessConstructor and Description
public
DefaultCharInputReader(char
the normalized newline character (as defined in Format#getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.
normalizedLineSeparator
,
int
the buffer size used to store characters read from the input.
bufferSize
,
int
starting range of characters considered to be whitespace.
whitespaceRangeStart
,
boolean
indicates whether to automatically close the input when stop() is called
closeOnStop
)

Creates a new instance with the mandatory characters for handling newlines transparently.

public
DefaultCharInputReader(char[]
the sequence of characters that represent a newline, as defined in Format#getLineSeparator()
lineSeparator
,
char
the normalized newline character (as defined in Format#getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.
normalizedLineSeparator
,
int
the buffer size used to store characters read from the input.
bufferSize
,
int
starting range of characters considered to be whitespace.
whitespaceRangeStart
,
boolean
indicates whether to automatically close the input when stop() is called
closeOnStop
)

Creates a new instance with the mandatory characters for handling newlines transparently.

Method Summary

Modifier and TypeMethod and Description
public void
reloadBuffer()

Implements abstract com.univocity.parsers.common.input.AbstractCharInputReader.reloadBuffer.

Copies a sequence of characters from the input into the DefaultCharInputReader#buffer, and updates the DefaultCharInputReader#length to the number of characters read.
protected void
setReader(Reader reader)

Implements abstract com.univocity.parsers.common.input.AbstractCharInputReader.setReader.

Passes the java.io.Reader provided in the AbstractCharInputReader#start(Reader) method to the extending class so it can begin loading characters from it.
public void
stop()

Implements com.univocity.parsers.common.input.CharInputReader.stop.

Stops the CharInputReader from reading characters from the java.io.Reader provided in CharInputReader#start(Reader) and closes it.
Inherited from com.univocity.parsers.common.input.AbstractCharInputReader:
addInputAnalysisProcesscharCountcurrentParsedContentcurrentParsedContentLengthenableNormalizeLineEndingsgetChargetLineSeparatorgetQuotedStringgetStringlastIndexOflineCountmarkRecordStartnextCharreadCommentskipLinesskipQuotedStringskipStringskipWhitespacestartunwrapInputStream

Field Detail

readerback to summary
private Reader reader
unwrappingback to summary
private boolean unwrapping

Constructor Detail

DefaultCharInputReaderback to summary
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:char

the normalized newline character (as defined in Format#getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.

bufferSize:int

the buffer size used to store characters read from the input.

whitespaceRangeStart:int

starting range of characters considered to be whitespace.

closeOnStop:boolean

indicates whether to automatically close the input when stop() is called

DefaultCharInputReaderback to summary
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:char[]

the sequence of characters that represent a newline, as defined in Format#getLineSeparator()

normalizedLineSeparator:char

the normalized newline character (as defined in Format#getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.

bufferSize:int

the buffer size used to store characters read from the input.

whitespaceRangeStart:int

starting range of characters considered to be whitespace.

closeOnStop:boolean

indicates whether to automatically close the input when stop() is called

Method Detail

reloadBufferback to summary
public void reloadBuffer()

Implements abstract com.univocity.parsers.common.input.AbstractCharInputReader.reloadBuffer.

Copies a sequence of characters from the input into the DefaultCharInputReader#buffer, and updates the DefaultCharInputReader#length to the number of characters read.

Annotations
@Override
setReaderback to summary
protected void setReader(Reader reader)

Implements abstract com.univocity.parsers.common.input.AbstractCharInputReader.setReader.

Doc from com.univocity.parsers.common.input.AbstractCharInputReader.setReader.

Passes the java.io.Reader provided in the AbstractCharInputReader#start(Reader) method to the extending class so it can begin loading characters from it.

Parameters
reader:Reader

the java.io.Reader provided in AbstractCharInputReader#start(Reader)

Annotations
@Override
stopback to summary
public void stop()

Implements com.univocity.parsers.common.input.CharInputReader.stop.

Doc from com.univocity.parsers.common.input.CharInputReader.stop.

Stops the CharInputReader from reading characters from the java.io.Reader provided in CharInputReader#start(Reader) and closes it.

Annotations
@Override