CARVIEW |
Select Language
HTTP/2 200
server: GitHub.com
content-type: text/html; charset=utf-8
last-modified: Thu, 29 Oct 2015 19:20:12 GMT
access-control-allow-origin: *
etag: W/"5632716c-6486"
expires: Wed, 23 Jul 2025 22:45:19 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: EB7C:35AEC1:108AD0:135981:688163A6
accept-ranges: bytes
age: 0
date: Wed, 23 Jul 2025 22:35:19 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210035-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753310119.208139,VS0,VE219
vary: Accept-Encoding
x-fastly-request-id: c39488989bd09f8c827535aac81fd8154074b7b5
content-length: 3737
ICsvBeanReader (Super CSV 2.4.0 API)
org.supercsv.io
Interface ICsvBeanReader
-
- All Superinterfaces:
- AutoCloseable, Closeable, ICsvReader
- All Known Implementing Classes:
- CsvBeanReader
public interface ICsvBeanReader extends ICsvReader
Interface for CSV readers reading into objects/beans.- Author:
- Kasper B. Graversen, James Bassett
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description <T> T
read(Class<T> clazz, String... nameMapping)
Reads a row of a CSV file and populates an instance of the specified class, using the supplied name mapping to map column values to the appropriate fields.<T> T
read(Class<T> clazz, String[] nameMapping, CellProcessor... processors)
Reads a row of a CSV file and populates an instance of the specified class, using the supplied name mapping to map column values to the appropriate fields.<T> T
read(T bean, String... nameMapping)
Reads a row of a CSV file and populates the bean, using the supplied name mapping to map column values to the appropriate fields.<T> T
read(T bean, String[] nameMapping, CellProcessor... processors)
Reads a row of a CSV file and populates the bean, using the supplied name mapping to map column values to the appropriate fields.-
Methods inherited from interface org.supercsv.io.ICsvReader
get, getHeader, getLineNumber, getRowNumber, getUntokenizedRow, length
-
-
-
-
Method Detail
-
read
<T> T read(Class<T> clazz, String... nameMapping) throws IOException
Reads a row of a CSV file and populates an instance of the specified class, using the supplied name mapping to map column values to the appropriate fields.- Type Parameters:
T
- the bean type- Parameters:
clazz
- the type to instantiate. If the type is a class then a new instance will be created using the default no-args constructor. If the type is an interface, a proxy object which implements the interface will be created instead.nameMapping
- an array of Strings linking the CSV columns to their corresponding field in the bean (the array length should match the number of columns). A null entry in the array indicates that the column should be ignored (the field in the bean will be null - or its default value).- Returns:
- a populated bean or null if EOF
- Throws:
IOException
- if an I/O error occurredIllegalArgumentException
- if nameMapping.length != number of columns readNullPointerException
- if clazz or nameMapping are nullSuperCsvException
- if there was a general exception while reading/processingSuperCsvReflectionException
- if there was an reflection exception while mapping the values to the bean- Since:
- 1.0
-
read
<T> T read(T bean, String... nameMapping) throws IOException
Reads a row of a CSV file and populates the bean, using the supplied name mapping to map column values to the appropriate fields.- Type Parameters:
T
- the bean type- Parameters:
bean
- the bean to populatenameMapping
- an array of Strings linking the CSV columns to their corresponding field in the bean (the array length should match the number of columns). A null entry in the array indicates that the column should be ignored (the field in the bean will be null - or its default value).- Returns:
- a populated bean or null if EOF
- Throws:
IOException
- if an I/O error occurredIllegalArgumentException
- if nameMapping.length != number of columns readNullPointerException
- if bean or nameMapping are nullSuperCsvException
- if there was a general exception while reading/processingSuperCsvReflectionException
- if there was an reflection exception while mapping the values to the bean- Since:
- 2.2.0
-
read
<T> T read(Class<T> clazz, String[] nameMapping, CellProcessor... processors) throws IOException
Reads a row of a CSV file and populates an instance of the specified class, using the supplied name mapping to map column values to the appropriate fields. Before population the data can be further processed by cell processors (as with the nameMapping array, each element in the processors array corresponds with a CSV column). A null entry in the processors array indicates no further processing is required (the unprocessed String value will be set on the bean's field).- Type Parameters:
T
- the bean type- Parameters:
clazz
- the type to instantiate. If the type is a class then a new instance will be created using the default no-args constructor. If the type is an interface, a proxy object which implements the interface will be created instead.nameMapping
- an array of Strings linking the CSV columns to their corresponding field in the bean (the array length should match the number of columns). A null entry in the array indicates that the column should be ignored (the field in the bean will be null - or its default value).processors
- an array of CellProcessors used to further process data before it is populated on the bean (each element in the processors array corresponds with a CSV column - the number of processors should match the number of columns). A null entry indicates no further processing is required (the unprocessed String value will be set on the bean's field).- Returns:
- a populated bean or null if EOF
- Throws:
IOException
- if an I/O error occurredNullPointerException
- if clazz, nameMapping, or processors are nullSuperCsvConstraintViolationException
- if a CellProcessor constraint failedSuperCsvException
- if there was a general exception while reading/processingSuperCsvReflectionException
- if there was an reflection exception while mapping the values to the bean- Since:
- 1.0
-
read
<T> T read(T bean, String[] nameMapping, CellProcessor... processors) throws IOException
Reads a row of a CSV file and populates the bean, using the supplied name mapping to map column values to the appropriate fields. Before population the data can be further processed by cell processors (as with the nameMapping array, each element in the processors array corresponds with a CSV column). A null entry in the processors array indicates no further processing is required (the unprocessed String value will be set on the bean's field).- Type Parameters:
T
- the bean type- Parameters:
bean
- the bean to populatenameMapping
- an array of Strings linking the CSV columns to their corresponding field in the bean (the array length should match the number of columns). A null entry in the array indicates that the column should be ignored (the field in the bean will be null - or its default value).processors
- an array of CellProcessors used to further process data before it is populated on the bean (each element in the processors array corresponds with a CSV column - the number of processors should match the number of columns). A null entry indicates no further processing is required (the unprocessed String value will be set on the bean's field).- Returns:
- a populated bean or null if EOF
- Throws:
IOException
- if an I/O error occurredNullPointerException
- if bean, nameMapping, or processors are nullSuperCsvConstraintViolationException
- if a CellProcessor constraint failedSuperCsvException
- if there was a general exception while reading/processingSuperCsvReflectionException
- if there was an reflection exception while mapping the values to the bean- Since:
- 2.2.0
-
-
Copyright © 2007–2015 Super CSV. All rights reserved.