Top Description Inners Fields Constructors Methods
de.siegmar.fastcsv.reader

pack-priv final Class RelaxedCsvParser

extends Object
implements CsvParser
Class Inheritance
All Implemented Interfaces
de.siegmar.fastcsv.reader.CsvParser, java.io.Closeable, java.lang.AutoCloseable
Annotations
@SuppressWarnings:checkstyle:CyclomaticComplexity, checkstyle:ExecutableStatementCount, checkstyle:InnerAssignment, checkstyle:JavaNCSS, checkstyle:NestedIfDepth
Static Imports
de.siegmar.fastcsv.util.Util.CR, .Util.LF

Less strict but also less performant CSV parser.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final CsvCallbackHandler<?>
private final char
private final CommentStrategy
private char[]
private int
private static final int
private static final int
private final char
private final char[]
private int
private final int
private final char
private final RelaxedCsvParser.LookaheadReader
private static final char
private long
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
RelaxedCsvParser(final String fsep, final char qChar, final CommentStrategy cStrat, final char cChar, final boolean trimWhitespacesAroundQuotes, final CsvCallbackHandler<?> callbackHandler, final int maxBufferSize, final Reader reader)

pack-priv
RelaxedCsvParser(final String fsep, final char qChar, final CommentStrategy cStrat, final char cChar, final boolean trimWhitespacesAroundQuotes, final CsvCallbackHandler<?> callbackHandler, final int maxBufferSize, final String data)

Method Summary

Modifier and TypeMethod and Description
private void
appendChar(final int ch)

private static void
assertFields(final String fieldSeparator, final char quoteCharacter, final char commentCharacter, final CommentStrategy commentStrategy)

public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

private boolean
private static char[]
public long
getStartingLineNumber()

Implements de.siegmar.fastcsv.reader.CsvParser.getStartingLineNumber.

Returns the starting line number of the last parsed record.

public boolean
parse()

Implements de.siegmar.fastcsv.reader.CsvParser.parse.

Parses the next record from the stream and passes it to the callback handler.

private void
private boolean
private boolean
parseUnquoted(int ch)

public String
peekLine()

Implements de.siegmar.fastcsv.reader.CsvParser.peekLine.

Returns the next line from the stream without consuming it.

public void
reset(final long startingLineNumber)

Implements de.siegmar.fastcsv.reader.CsvParser.reset.

Resets the parser to the specified starting line number.

public void
skipLine(final int numCharsToSkip)

Implements de.siegmar.fastcsv.reader.CsvParser.skipLine.

Skips a line in the stream after skipping the specified number of characters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callbackHandlerback to summary
private final CsvCallbackHandler<?> callbackHandler
cCharback to summary
private final char cChar
cStratback to summary
private final CommentStrategy cStrat
currentFieldback to summary
private char[] currentField
currentFieldIndexback to summary
private int currentFieldIndex
DEFAULT_BUFFER_SIZEback to summary
private static final int DEFAULT_BUFFER_SIZE
EOFback to summary
private static final int EOF
fsepback to summary
private final char fsep
fsepRemainderback to summary
private final char[] fsepRemainder
Annotations
@Nullable
linesback to summary
private int lines
maxBufferSizeback to summary
private final int maxBufferSize
qCharback to summary
private final char qChar
readerback to summary
private final RelaxedCsvParser.LookaheadReader reader
SPACEback to summary
private static final char SPACE
startingLineNumberback to summary
private long startingLineNumber
trimWhitespacesAroundQuotesback to summary
private final boolean trimWhitespacesAroundQuotes

Constructor Detail

RelaxedCsvParserback to summary
pack-priv RelaxedCsvParser(final String fsep, final char qChar, final CommentStrategy cStrat, final char cChar, final boolean trimWhitespacesAroundQuotes, final CsvCallbackHandler<?> callbackHandler, final int maxBufferSize, final Reader reader)
Annotations
@SuppressWarnings:checkstyle:ParameterNumber
RelaxedCsvParserback to summary
pack-priv RelaxedCsvParser(final String fsep, final char qChar, final CommentStrategy cStrat, final char cChar, final boolean trimWhitespacesAroundQuotes, final CsvCallbackHandler<?> callbackHandler, final int maxBufferSize, final String data)
Annotations
@SuppressWarnings:checkstyle:ParameterNumber

Method Detail

appendCharback to summary
private void appendChar(final int ch)
assertFieldsback to summary
private static void assertFields(final String fieldSeparator, final char quoteCharacter, final char commentCharacter, final CommentStrategy commentStrategy)
closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
currentFieldHasOnlyWhitespaceback to summary
private boolean currentFieldHasOnlyWhitespace()
extractFsepRemainderback to summary
private static char[] extractFsepRemainder(final String fsep)
Annotations
@Nullable
@SuppressWarnings:PMD.AvoidLiteralsInIfCondition, PMD.ReturnEmptyCollectionRatherThanNull
getStartingLineNumberback to summary
public long getStartingLineNumber()

Implements de.siegmar.fastcsv.reader.CsvParser.getStartingLineNumber.

Doc from de.siegmar.fastcsv.reader.CsvParser.getStartingLineNumber.

Returns the starting line number of the last parsed record.

Annotations
@Override
parseback to summary
public boolean parse() throws IOException

Implements de.siegmar.fastcsv.reader.CsvParser.parse.

Doc from de.siegmar.fastcsv.reader.CsvParser.parse.

Parses the next record from the stream and passes it to the callback handler.

Annotations
@SuppressWarnings:checkstyle:ReturnCount, checkstyle:NPathComplexity
@Override
parseCommentback to summary
private void parseComment() throws IOException
Annotations
@SuppressWarnings:PMD.AssignmentInOperand
parseQuotedback to summary
private boolean parseQuoted() throws IOException
Annotations
@SuppressWarnings:checkstyle:NPathComplexity, checkstyle:ReturnCount, checkstyle:BooleanExpressionComplexity, PMD.AssignmentInOperand
parseUnquotedback to summary
private boolean parseUnquoted(int ch) throws IOException
Annotations
@SuppressWarnings:checkstyle:ReturnCount, checkstyle:FinalParameters, checkstyle:ParameterAssignment, checkstyle:NPathComplexity, checkstyle:BooleanExpressionComplexity, PMD.AvoidReassigningParameters
peekLineback to summary
public String peekLine() throws IOException

Implements de.siegmar.fastcsv.reader.CsvParser.peekLine.

Doc from de.siegmar.fastcsv.reader.CsvParser.peekLine.

Returns the next line from the stream without consuming it.

Annotations
@Override
resetback to summary
public void reset(final long startingLineNumber)

Implements de.siegmar.fastcsv.reader.CsvParser.reset.

Doc from de.siegmar.fastcsv.reader.CsvParser.reset.

Resets the parser to the specified starting line number.

Annotations
@SuppressWarnings:checkstyle:HiddenField
@Override
skipLineback to summary
public void skipLine(final int numCharsToSkip) throws IOException

Implements de.siegmar.fastcsv.reader.CsvParser.skipLine.

Doc from de.siegmar.fastcsv.reader.CsvParser.skipLine.

Skips a line in the stream after skipping the specified number of characters.

Annotations
@SuppressWarnings:checkstyle:MultipleVariableDeclarations
@Override
de.siegmar.fastcsv.reader back to summary

private final Class RelaxedCsvParser.LookaheadReader

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable

Field Summary

Modifier and TypeField and Description
private final char[]
private int
private final Reader
private int

Constructor Summary

AccessConstructor and Description
pack-priv
LookaheadReader(final Reader reader, final int bufferSize)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

pack-priv boolean
consumeIf(final char[] chars)

pack-priv boolean
private void
ensureBuffered(final int required)

pack-priv String
pack-priv int
read()

pack-priv void
skip(final int numCharsToSkip)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final char[] buffer
lenback to summary
private int len
readerback to summary
private final Reader reader
startback to summary
private int start

Constructor Detail

LookaheadReaderback to summary
pack-priv LookaheadReader(final Reader reader, final int bufferSize)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
consumeIfback to summary
pack-priv boolean consumeIf(final char[] chars) throws IOException
Annotations
@SuppressWarnings:PMD.UseVarargs
consumeLFback to summary
pack-priv boolean consumeLF() throws IOException
ensureBufferedback to summary
private void ensureBuffered(final int required) throws IOException
peekLineback to summary
pack-priv String peekLine() throws IOException
readback to summary
pack-priv int read() throws IOException
skipback to summary
pack-priv void skip(final int numCharsToSkip)