Questions tagged [univocity]

univocity provides CSV/TSV/text file parsers for Java. Use this tag for questions when using their parser and also include other tags to indicate what other issues or frameworks are involved

Univocity provides open-source parsers with a wide range of features to read data by fields, into JavaBeans; writing delimited files, routines to provide short-cuts to common steps, and handling heading rows.

See also

120 questions
5
votes
1 answer

Univocity - how to provide date formats dynamically

I am trying to validate Date fields in my project with univocity parser. I know there are custom validators and format annotation in univocity. But there we need to provide static date formats while implementing bean classes. @Format(formats =…
srkn
  • 88
  • 6
5
votes
1 answer

UNIVOCITY-PARSERS for csv to bean object stopping as soon as error has occured

I'm using UNIVOCITY-PARSERS for converting csv file rows into java objects. while processing the file, if it encounters any problem any of the column in row, then it parsing getting stopped in that row and throwing exception. But i need something…
Abhishyam
  • 158
  • 10
5
votes
1 answer

Univocity - How to return one bean per row using iterator style?

Introduction I am building a process to merge a few big sorted csv files. I am currently looking into using Univocity to do this. The way I setup the merge is to use beans that implement comparable interface. Given The simplified file looks like…
Sander_M
  • 1,109
  • 2
  • 18
  • 36
4
votes
1 answer

Univocity Parser: TextParsingException while parsing a line which has a starting double quote(") but does not have an ending double quote(")

Getting exception while parsing file: com.univocity.parsers.common.TextParsingException: Length of parsed input (4097) exceeds the maximum number of characters defined in your parser settings (4096). Identified line separator characters in the…
Maverick
  • 1,519
  • 18
  • 32
3
votes
1 answer

Univocity Parser - How to get row number in parsed bean

When using Univocity FixedWidthParser, how can I add the record/line number as a field in the parsed bean? Is there an option where a bean property can be tagged as Record Number like: // Bean representing a record public class MyRecord { …
GSai
  • 132
  • 2
  • 9
3
votes
0 answers

Spark CSV parsing for different files and options using univocity csv parser scala

I am trying to parse this csv file with the following…
H.Aadhithya
  • 205
  • 1
  • 12
3
votes
1 answer

mapping particular column of a csv file with particular POJO's field

I have to map particular CSV column based on index with particular POJO attributes. Mapping will be based on a json file which will contain columnIndex and attribute name which means that for a particular columnIndex from csv file you have to map…
nitin tyagi
  • 1,176
  • 1
  • 19
  • 52
3
votes
2 answers

How to validate CSV headers using Univocity routines?

Im using Univocity CSV parser with routines when I iterate over Java beans. Is there a way to validate CSV header? When I edit the CSV and add invalid header, it just insert into given bean null without any error. Model class: public class Customer…
Michael
  • 169
  • 2
  • 2
  • 16
3
votes
1 answer

Java Mapping Class and List to Generic Types

I am trying to create a method which accepts a class as parameter and do some operation and return a list of same class. I am trying to use Generics and have the below code. Question: What should I do to map the provided class to the…
Purus
  • 5,701
  • 9
  • 50
  • 89
3
votes
1 answer

Univocity - Irregular csv parsing

I have irregular (albeit consistent) "csv" files I need to parse. Content looks like this: Field1: Field1Text Field2: Field2Text Field3 (need to ignore) Field4 (need to ignore) Field5 Field5Text // Cars - for…
Hurricane
  • 1,454
  • 1
  • 13
  • 31
3
votes
1 answer

uniVocity doesn't parse the first column into beans

I'm trying to read CSV files from GTFS.zip with help of uniVocity-parsers and run into an issue that I can't figure out. For some reason it seems the first column of some CSV files won't be parsed correctly. For example in the "stops.txt" file that…
Kazanagi
  • 35
  • 5
2
votes
1 answer

Why can't we unmarshal data into beans using univocity parser in apache camel?

Univocity parser supports reading data into bean when it is written in plain java - https://www.univocity.com/pages/univocity_parsers_tutorial#using-annotations-to-map-your-java-beans But when univocity is used with camel, it only unmarshals the…
Gourav Dey
  • 31
  • 4
2
votes
2 answers

Univocity - Detect missing column when parsing CSV

I'm using Univocity library to parse CSV and it works perfectly, but I need a way to detect if the file being parsed has less columns than required For example, if I'm expecting a 3 columns file, with columns mapped to [H1,H2,H3] then I received a…
Safaa Selim
  • 106
  • 4
2
votes
1 answer

UniVocity howto add parameters to a custom Validator

I'm creating some custom Validators for univocity parser and I want to add some parameters like this: public class Size implements Validator int max; and then use it like this: @Parsed @Validate(nullable = false, validators =…
2
votes
1 answer

CsvParser not working for missing double quotes

I have a messages in file like below and I am using com.univocity.parsers.csv.CsvParser to split the string based on delimiter(in this case its -) 1-bc-"name"-def-address 1-abc-"name-def-address I create my CsvParser object like private val…
Explorer
  • 1,491
  • 4
  • 26
  • 67
1
2 3 4 5 6 7 8