You can use java.io.StringReader. Example:

final String inputString = "value1,value2,value3";

try (CSVReader reader = new CSVReader(new StringReader(inputString))) {
    // Your code here
}
Answer from Eien on Stack Overflow
🌐
DigitalOcean
digitalocean.com › community › tutorials › opencsv-csvreader-csvwriter-example
OpenCSV CSVReader CSVWriter Example | DigitalOcean
August 3, 2022 - Our first CSVReader example is to read CSV file lines one by one and then convert to list of Employee. package com.journaldev.csv.opencsv.parser; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.journaldev.csv.model.Employee; import com.opencsv.CSVReader; /** * OpenCSV CSVReader Example, Read line by line * * @author pankaj * */ public class OpenCSVReaderLineByLineExample { public static void main(String[] args) throws IOException { CSVReader reader = new CSVReader(new FileReader("emps.csv"), ','); List<Employee> emps = new Ar
🌐
Baeldung
baeldung.com › home › java › java io › introduction to opencsv
Introduction to OpenCSV | Baeldung
May 11, 2024 - CSVReaderBuilder allows us to skip the column headings and set parsing rules through CSVParserBuilder.
🌐
SourceForge
opencsv.sourceforge.net
opencsv –
At the most basic, you can use opencsv to parse an input and return a String[], thus: CSVReader reader = new CSVReaderBuilder(new FileReader("yourfile.csv")).build(); String [] nextLine; while ((nextLine = reader.readNext()) != null) { // nextLine[] is an array of values from the line ...
🌐
ZetCode
zetcode.com › java › opencsv
Java Opencsv - read, write CSV files in Java with Opencsv
July 4, 2024 - A CSVReader is created with CSVReaderBuilder. ... We read all the elements into a list in one shot with the readAll method. This method should not be used for large files. The CSVWriter class is used to write data to a CSV file. ... import com.opencsv.CSVWriter; import java.io.FileOutputStream; ...
Find elsewhere
🌐
How to do in Java
howtodoinjava.com › home › java libraries › opencsv – read and write csv files in java
OpenCSV - Read and Write CSV Files in Java
October 1, 2022 - CSVParser: A very simple CSV parser ... a single line into fields. CSVReader: You will be using this class most of the time while reading a CSV file from your java application code....
🌐
CalliCoder
callicoder.com › java-read-write-csv-file-opencsv
Read / Write CSV files in Java using OpenCSV | CalliCoder
February 18, 2022 - If you want to skip the header row, then you can use a CSVReaderBuilder class to construct a CSVReader with the specified number of lines skipped. import com.opencsv.CSVReaderBuilder; CSVReader csvReader = new CSVReaderBuilder(reader).withSkipLines(1).build(); The real strength of OpenCSV library is that you can directly parse CSV records into Java objects.
🌐
Javadoc.io
javadoc.io › doc › com.opencsv › opencsv › 4.0 › com › opencsv › CSVReader.html
CSVReader - opencsv 4.0 javadoc
Latest version of com.opencsv:opencsv · https://javadoc.io/doc/com.opencsv/opencsv · Current version 4.0 · https://javadoc.io/doc/com.opencsv/opencsv/4.0 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/com.opencsv/opencsv/4.0/package-list ·
🌐
MangoHost
mangohost.net › mangohost blog › opencsv csvreader and csvwriter example
OpenCSV CSVReader and CSVWriter Example
August 2, 2025 - OpenCSV operates on a streaming principle, processing CSV data line by line rather than loading entire files into memory. The CSVReader uses configurable parsers that handle RFC 4180 compliance while remaining flexible enough for non-standard ...
🌐
GeeksforGeeks
geeksforgeeks.org › java › reading-csv-file-java-using-opencsv
Reading a CSV file in Java using OpenCSV - GeeksforGeeks
July 11, 2025 - 3. You can Download OpenCSV Jar and include in your project class path. ... CSVReader - This class provides the operations to read the CSV file as a list of String array.
🌐
GitHub
github.com › cygri › opencsv › blob › master › src › main › java › com › opencsv › CSVReader.java
opencsv/src/main/java/com/opencsv/CSVReader.java at master · cygri/opencsv
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
Author   cygri
🌐
Stack Abuse
stackabuse.com › reading-and-writing-csvs-in-java-with-opencsv
Reading and Writing CSVs in Java with OpenCSV
February 20, 2019 - OpenCSV has two objects types for reading CSVs - CSVReader, and its sub class CSVReaderHeaderAware.
🌐
SourceForge
opencsv.sourceforge.net › apidocs › com › opencsv › CSVWriter.html
CSVWriter (opencsv 5.12.0 API)
com.opencsv · java.lang.Object · com.opencsv.AbstractCSVWriter · com.opencsv.CSVWriter · All Implemented Interfaces: ICSVWriter, Closeable, Flushable, AutoCloseable · public class CSVWriter extends AbstractCSVWriter · A very simple CSV writer released under a commercial-friendly license.
🌐
Stack Overflow
stackoverflow.com › questions › 53288514 › read-a-csv-file-from-the-beginning-after-having-reached-the-end-java-opencsv
read a csv file from the beginning after having reached the end (Java, OpenCSV) - Stack Overflow
CopyList<String[]> records = csvReader.readAll(); int no_of_rows = records.size(); Copyimport com.opencsv.CSVReader; import java.io.Reader; import java.nio.file.Files; import java.nio.file.Paths; public class CSV_Reader { private static final String SAMPLE_CSV_FILE_PATH = "some_path"; public static void main(String[] args) { try { Reader reader = Files.newBufferedReader(Paths.get(SAMPLE_CSV_FILE_PATH)); System.out.println("before new object"); CSVReader csvReader = new CSVReader(reader); String[] nextRecord; System.out.println("before while"); int no_of_rows = 0; while ( (nextRecord = csvReader.readNext()) != null ) { no_of_rows++; } System.out.println("Number of lines is: " + no_of_rows ); String[] string_vector = new String[no_of_rows]; while ((nextRecord = csvReader.readNext()) != null) { //I want to do some stuff here.
🌐
Maven Repository
mvnrepository.com › artifact › com.opencsv › opencsv
Maven Repository: com.opencsv » opencsv
July 27, 2025 - Home » com.opencsv » opencsv · A simple library for reading and writing CSV in Java · LicenseApache 2.0 · CategoriesCSV Libraries · Tagsformatdelimiteddatacsvtabular · Ranking · #331in MvnRepository · #1in CSV Libraries · HomePage http://opencsv.sf.net 🔍 Inspect URL ·