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
1
vote
1 answer

Univocity parsers / Required validation (NotNull)

I'm using the fixed length parser to import files and java beans with annotations as mapping classes. How can I define a field as required? Couldn't find an annotation. Could I implement a custom converter for such a validation?
Peter
  • 163
  • 1
  • 4
1
vote
1 answer

Univocity bean processor showing inconsistent behaviour in distributed system

I am using univocity bean processor for file parsing. I was able to successfully use it on my local box. But on deploying the same code on an environment with multiple hosts, the parser is showing inconsistent behavior. Say for invalid files, it is…
Harsh
  • 75
  • 5
1
vote
1 answer

univocity parse csv to same pojo based on dynamic column mappings

I'm using univocity parsers with BeanListProcessor to map to my Java Bean which is good provided the column names don't change. However, I also need to parse a csv file which comes with different columns for each type of user. I have the mappings…
vin2527
  • 15
  • 6
1
vote
2 answers

Univocity - how to properly write a row without a primitive array

I am using this: List row = new ArrayList(); row.add("value 1"); row.add("value 2"); writer.writeRow(row); Which outputs what's essentially an ArrayList toString() value: "[value1, value2]" How to obtain the following? "value1,…
Buffalo
  • 3,861
  • 8
  • 44
  • 69
1
vote
2 answers

Univocity CSV : Missing quotes after parsing

I am trying to parse a CSV with Quotes using Univocity CSV, I find that after parsing the close quotes are missing from some values.…
Srividya
  • 51
  • 4
1
vote
1 answer

Using Univocity, how can I convert a date string value to a Date type in Java

I'll like to parse column zero in a csv file to a particular datatype, in this example a Date Object. The method below is what I use currently to parse a csv file but I don't know how to incorporate this requirement. import java.sql.Date; public…
Ilyas Patel
  • 400
  • 2
  • 11
  • 27
1
vote
1 answer

How to parse TSV data into nested objects

I'm trying to parse the following TSV data into a nested object but my "title" field is always null within the Nested class. I've included the method at the bottom which converts the TSV data to the object. value1 | metaData1 | valueA | value2 |…
Ilyas Patel
  • 400
  • 2
  • 11
  • 27
1
vote
1 answer

Univocity - how to parse 3(n) lines as one row(bean)

I am evaluating Univocity parser for one of my project, Fixed width flat file format makes one record(Bean) from three detail recs (e.g., starts with AA, BB, CC) - would this file parseable using Univocity? I can use recordEndsOnNewline to continue…
Ronak Patel
  • 3,819
  • 1
  • 16
  • 29
1
vote
1 answer

Exclude fields from CSV

I'm converting Resultset to CSV using Univocity parser. I want only the user provided fields to be present in the output CSV if the fields are present in the resultset. If the field is not present in the resultset the corresponding column should be…
HyperioN
  • 3,433
  • 2
  • 22
  • 36
1
vote
1 answer

Java using uniVocity parser particular column data has comma and its not enclosed

I am mostly using uniVocity as a CSV parser, its a excellent parser. I have hit below problem with below rows, this file will have fixed number of 7 columns. The problem is with client name, it can have commas, the next column to it Type, it is…
bobby.dreamer
  • 366
  • 4
  • 19
1
vote
1 answer

Handling "", "-" CSV with Univocity

Any idea how I can get proper lines? some lines are getting glued, and I can't figure out how to stop it or why. col. 0: Date col. 1: Col2 col. 2: Col3 col. 3: Col4 col. 4: Col5 col. 5: Col6 col. 6: Col7 col. 7: Col7 col. 8: Col8 …
Buffalo
  • 3,861
  • 8
  • 44
  • 69
1
vote
1 answer

Set custom headers in output CSV using Univocity

I'm using Univocity for converting Resultset to String in CSV format using below code: StringWriter stringWriter = new StringWriter(); CsvWriterSettings csvWriterSettings = new CsvWriterSettings(); ResultSetMetaData metaData =…
HyperioN
  • 3,433
  • 2
  • 22
  • 36
1
vote
1 answer

Univocity - AutomaticConfiguration do not work with MultiBeanListProcessor

When I instantiate a FixedWidthParser with a MultiBeanListProcessor the CommonParserSettings#configureFromAnnotations(beanClass) is not called because, it is not an instance of AbstractBeanProcessor. Should not the method be called for each…
1
vote
2 answers

uniVocity - conversion to a List by position

I'm trying create a List from especific positions in the csv file, instead parentheses. class Person {// @Parsed private String name; @?? private Address address; @Convert(conversionClass = Emails2.class, args = { "," , "5,6" }) @Parsed private…
Eve
  • 37
  • 9
1
vote
1 answer

Mapping csv columns to composite Pojo classes

I am using univocity-parser library for this class Person{ @Parsed(index=1) String name; @Parsed(index=2) String age; Address address; } class Address{ @Parsed(index=3) String street; String city; } BeanListProcessor rowProcessor = new…
NewCoder
  • 11
  • 1