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
2
votes
1 answer

Parsing CSV file with @Parsed annotation in a Form - Univocity parser

I am trying to parse a CSV file with some @Parsed annotation in a form file but it's not working. I am using univocity lib Init.java public static void main(String[] args) throws FileNotFoundException { CsvParserSettings parserSettings =…
José Mendes
  • 950
  • 2
  • 14
  • 30
1
vote
1 answer

How to use column mapping with BatchedColumnProcessor in univocity

How can i use column mapping by using BatchedColumnProcessor in univocity? CsvParserSettings settings = new CsvParserSettings(); settings.setProcessor(new BatchedColumnProcessor(5) { @Override public void batchProcessed(int…
Salman S
  • 47
  • 1
  • 15
1
vote
2 answers

Optional fields in CSV parser

I am writing code to read a CSV file. A, B, C 1, 1, 1 2, 2, 2 Sometimes column C will be present, and sometimes it will not be. If it's not, I really don't care, but if it is I want to handle it. I'm also using the Univocity parsers, but don't…
gregmacfarlane
  • 2,121
  • 3
  • 24
  • 53
1
vote
0 answers

Univocity Error Handler for parsing fixed width multi-schema text file

I am using univocity 2.9.1 file parser for a fixed width text file which is multi-schema. I have setup the different record types using settings addFormatForLookahead method. settings.addFormatForLookahead("11",…
user518066
  • 1,277
  • 3
  • 23
  • 35
1
vote
0 answers

Parse fixed-width file with RowProcessor (Univocity)

I'm dealing with a fixed-width file with 3 different types of bean : Bean 1 (header) : length = 256 ; starts with 0256Q ; one single header Bean 2 (record) : length = 768 ; starts with 0768T ; repeatable Bean 3 (footer) : length = 256 ; starts with…
1
vote
1 answer

Univocity-parsers FixedWidth parsing with multiple records per line

I am trying to use the univocity-parsers to parse a fixed-width formatted file that includes a variable number of fixed-width records per line. Format is record id [6], # of sub-records [3], sub-record…
David B.
  • 13
  • 3
1
vote
1 answer

Can univocity execute validators in OR way insted of AND?

I would like to know if there is any way to execute the validators in an OR operator way insted of AND. Currently if the first fails, he doesn't run the other two, however I need him to run them all to return to the user all the respective fixes…
alobaton
  • 113
  • 8
1
vote
0 answers

Univocity get index line meanwhile parsing

Is there a way meanwhile processing the row gets the current index line of the file and assign that value to a property of the Bean mapped to?
1
vote
2 answers

Univocity Parser in Java, parsing the CSV based on a particular column

I am quite new to Univocity Parser and I want to know if there is any way I can parse the csv file based on a value of particular column, considering the size of CSV I want to parse it based on a date attribute.(For Ex: if date is 1/1/2020 then…
Ria Sachdeva
  • 113
  • 6
1
vote
1 answer

Univocity - return wrapped record with error context

Say I am parsing a CSV employee file. I have a pojo called Employee and i'm using univocity routines and an iterator. Iterator iterator = routines.iterate(Employee.class, ...) When an error occurs when parsing a row, I don't want to use…
gurpal2000
  • 1,004
  • 1
  • 17
  • 35
1
vote
1 answer

Univocity Parser trying to parse the file, but getting error

Unable to parse the file name. The main reason is new File is expecting pathName but I am passing String. How to convert String to pathName? //Creating listIterator to iterate over list ListIterator listIterator=…
Ria Sachdeva
  • 113
  • 6
1
vote
1 answer

CSVRecordReader and Un-terminated quoted field at end of CSV line

I have a problem with the datasets that I am using. They are CSV that contain fake news. My problem is with the CSVRecordReader class, which is what DataVec (Deeplearning4j) offers me. I am trying to make a spark transformation process. My problem…
Yuniel Acosta
  • 31
  • 1
  • 10
1
vote
1 answer

Use Univocity Parsers with Spring Batch

I am trying o use Univocity Parsers within Spring Batch. The problem I am facing is how to integrate them. Spring Batch Chunk Steps follow the flow for each row of the given file: I need to use Univocity inside an ItemReader. It executes the…
henrique romao
  • 560
  • 1
  • 8
  • 32
1
vote
1 answer

Univocity - How to define a preference order for the delimiter on the "format auto-detection"?

I'm trying to use the Univocity format auto-detection for parsing this CSV table: HEADER1, HEADER2, HEADER3 11, 12, 13 21, 22, 23 31, 32, 33 As you can see, there're same number of commas ',' and spaces ' '. Problem is that the heuristic for…
Pablorotten
  • 103
  • 1
  • 7
1
vote
1 answer

Why do I need to call parseLine twice in combination with a BeanListProcessor

I am parsing a CSV line by line using the Univocity (2.8.2) parser. It forces me to call parseLine("") twice to set the header. I have tried setting the header on the CSVParserSettings. String[] headers = {"name","age"}; …
Dave Weernink
  • 91
  • 1
  • 9