Top Interfaces Classes
[default module]

Package com.univocity.parsers.common


Interface Summary

Modifier and TypeInterface and Description
public interface
public interface
ConversionProcessor

A basic interface for classes that associate Conversion implementations with fields of a given input/output.

public interface
IterableResult<T, C extends Context>

An Iterable result that provides the current parsing context through the getContext() method

public interface
ParsingContext

Parsing context information available to instances of RowProcessor.

public interface
ProcessorErrorHandler<T extends Context>

The ProcessorErrorHandler is a callback used by the parser/writer to handle non-fatal DataProcessingExceptions that may occur when processing rows using a Processor or RowWriterProcessor.

public interface
ResultIterator<T, C extends Context>

An Iterator that provides the current parsing context through the getContext() method

public interface
RowProcessorErrorHandler

The RowProcessorErrorHandler is a callback used by the parser/writer to handle non-fatal DataProcessingExceptions that may occur when processing rows using a RowProcessor or RowWriterProcessor.

Class Summary

Modifier and TypeClass and Description
pack-priv abstract class
AbstractException

Parent class of the Exception classes thrown by univocity-parsers.

public abstract class
AbstractParser<
The specific parser settings configuration class, which can potentially provide additional configuration options supported by the parser implementation.
T extends CommonParserSettings<?>
>

The AbstractParser class provides a common ground for all parsers in univocity-parsers.

public abstract class
AbstractWriter<
The specific writer settings configuration class, which can potentially provide additional configuration options supported by the writer implementation.
S extends CommonWriterSettings<?>
>

The AbstractWriter class provides a common ground for all writers in univocity-parsers.

public class
ArgumentUtils

An utility class for validating inputs.

public class
ColumnMap

Class responsible for calculating and storing the position of fields parsed from the input.

public abstract class
CommonParserSettings<
the format supported by this parser.
F extends Format
>

This is the parent class for all configuration classes used by parsers (AbstractParser)

By default, all parsers work with, at least, the following configuration options in addition to the ones provided by CommonSettings:

  • rowProcessor: a callback implementation of the interface RowProcessor which handles the life cycle of the parsing process and processes each record extracted from the input
  • headerExtractionEnabled (defaults to false): indicates whether or not the first valid record parsed from the input should be considered as the row containing the names of each column
  • columnReorderingEnabled (defaults to true): indicates whether fields selected using the field selection methods (defined by the parent class CommonSettings) should be reordered.

    When disabled, each parsed record will contain values for all columns, in the order they occur in the input. Fields which were not selected will not be parsed but and the record will contain empty values.

    When enabled, each parsed record will contain values only for the selected columns. The values will be ordered according to the selection.

  • inputBufferSize (defaults to 1024*1024 characters): The number of characters held by the parser's buffer when processing the input.
  • readInputOnSeparateThread (defaults true if the number of available processors at runtime is greater than 1):

    When enabled, a reading thread (in input.concurrent.ConcurrentCharInputReader) will be started and load characters from the input, while the parser is processing its input buffer. This yields better performance, especially when reading from big input (greater than 100 mb)

    When disabled, the parsing process will briefly pause so the buffer can be replenished every time it is exhausted (in DefaultCharInputReader it is not as bad or slow as it sounds, and can even be (slightly) more efficient if your input is small)

  • numberOfRecordsToRead (defaults to -1): Defines how many (valid) records are to be parsed before the process is stopped. A negative value indicates there's no limit.
  • lineSeparatorDetectionEnabled (defaults to false): Attempts to identify what is the line separator being used in the input. The first row of the input will be read until a sequence of '\r\n', or characters '\r' or '\n' is found. If a match is found, then it will be used as the line separator to use to parse the input
public abstract class
CommonSettings<
the format supported by this settings class.
F extends Format
>

This is the parent class for all configuration classes used by parsers (AbstractParser) and writers (AbstractWriter)

By default, all parsers and writers work with, at least, the following configuration options:

  • format (each file format provides its default): the input/output format of a given file
  • nullValue (defaults to null):

    when reading, if the parser does not read any character from the input, the nullValue is used instead of an empty string

    when writing, if the writer has a null object to write to the output, the nullValue is used instead of an empty string

  • maxCharsPerColumn (defaults to 4096): The maximum number of characters allowed for any given value being written/read.

    You need this to avoid OutOfMemoryErrors in case a file does not have a valid format. In such cases the parser might just keep reading from the input until its end or the memory is exhausted. This sets a limit which avoids unwanted JVM crashes.

  • maxColumns (defaults to 512): a hard limit on how many columns a record can have. You need this to avoid OutOfMemory errors in case of inputs that might be inconsistent with the format you are dealing with
  • skipEmptyLines (defaults to true):

    when reading, if the parser reads a line that is empty, it will be skipped.

    when writing, if the writer receives an empty or null row to write to the output, it will be ignored

  • ignoreTrailingWhitespaces (defaults to true): removes trailing whitespaces from values being read/written
  • ignoreLeadingWhitespaces (defaults to true): removes leading whitespaces from values being read/written
  • headers (defaults to null): the field names in the input/output, in the sequence they occur.

    when reading, the given header names will be used to refer to each column irrespective of whether or not the input contains a header row

    when writing, the given header names will be used to refer to each column and can be used for writing the header row

  • field selection (defaults to none): a selection of fields for reading and writing. Fields can be selected by their name or their position.

    when reading, the selected fields only will be parsed and the remaining fields will be discarded.

    when writing, the selected fields only will be written and the remaining fields will be discarded

public abstract class
CommonWriterSettings<
the format supported by this writer.
F extends Format
>

This is the parent class for all configuration classes used by writers (AbstractWriter)

By default, all writers work with, at least, the following configuration options in addition to the ones provided by CommonSettings:

  • rowWriterProcessor: a implementation of the interface RowWriterProcessor which processes input objects into a manageable format for writing.
public abstract class
ContextSnapshot<T extends Context>

A snapshot of a Context which retains copies of variable attributes of a given Context to store the state of the parsing process at a given point in time.

public abstract class
ContextWrapper<T extends Context>

A simple a wrapper for a Context.

public class
DataProcessingException

A DataProcessingException is an error thrown during the processing of a record successfully parsed.

public class
DataValidationException

A DataValidationException is an error thrown during the processing of a record successfully parsed, but whose data failed to pass a validation defined by annotation com.univocity.parsers.annotations.Validate

public class
DefaultContext

Default implementation of the Context interface with essential information about the output being produced.

public abstract class
DefaultConversionProcessor

The base class for RowProcessor and RowWriterProcessor implementations that support value conversions provided by Conversion instances.

public class
DefaultParsingContext

The default ParsingContext implementation used internally by AbstractParser to expose information about a parsing process in execution.

pack-priv class
DummyFormat

A concrete (dummy) implementation of Format.

public abstract class
Format

This is the parent class for all configuration classes that define a text format.

pack-priv class
Internal

Internal class to keep common internal functions that are used in multiple places.

pack-priv class
LineReader

A simple Reader implementation to enable parsers to process lines on demand, via AbstractParser#parseLine(String)

pack-priv class
NoopParsingContext

A ParsingContext implementation that does nothing.

public class
NoopProcessorErrorHandler<
the Context type provided by the parser implementation.
T extends Context
>

An (singleton) implementation of ProcessorErrorHandler that simply rethrows any DataProcessingException that comes into its handleError(DataProcessingException, Object[], Context)} method

pack-priv class
public class
NormalizedString

A NormalizedString allows representing text in a normalized fashion.

public class
ParserOutput

The ParserOutput is the component that manages records parsed by AbstractParser and their values.

public class
ParsingContextSnapshot

A snapshot of a ParsingContext which retains copies of variable attributes of a given ParsingContext to store the state of the parsing process at a given point in time.

public class
ParsingContextWrapper

A simple a wrapper for a ParsingContext.

public abstract class
RetryableErrorHandler<T extends Context>

A ProcessorErrorHandler implementation that gives the user a chance to provide a default value for columns that could not be processed due to an exception, through the method setDefaultValue(Object).

public abstract class
StringCache<
the type of entry to be stored in the cache
T
>

A simple cache of values associated with strings.

public class
TextParsingException

Exception type used provide information about any issue that might happen while parsing from a given input.

public class
TextWritingException

Exception type used provide information about any issue that might happen while writing to a given output.