Package org.beanio.stream.csv
Class CsvRecordParser
- java.lang.Object
-
- org.beanio.stream.csv.CsvRecordParser
-
- All Implemented Interfaces:
RecordMarshaller
,RecordUnmarshaller
public class CsvRecordParser extends java.lang.Object implements RecordMarshaller, RecordUnmarshaller
' A combinedRecordMarshaller
andRecordUnmarshaller
implementation for CSV formatted records.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description CsvRecordParser()
Constructs a newCsvRecordParser
.CsvRecordParser(CsvParserConfiguration config)
Constructs a newCsvRecordParser
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
marshal(java.lang.Object record)
Marshals a single record object to aString
.java.lang.String
marshal(java.lang.String[] record)
Marshals aString
array into a CSV formatted record.java.lang.Object
unmarshal(java.lang.String text)
Unmarshals a single record.
-
-
-
Constructor Detail
-
CsvRecordParser
public CsvRecordParser()
Constructs a newCsvRecordParser
.
-
CsvRecordParser
public CsvRecordParser(CsvParserConfiguration config)
Constructs a newCsvRecordParser
.- Parameters:
config
- theCsvParserConfiguration
-
-
Method Detail
-
unmarshal
public java.lang.Object unmarshal(java.lang.String text) throws RecordIOException
Description copied from interface:RecordUnmarshaller
Unmarshals a single record.- Specified by:
unmarshal
in interfaceRecordUnmarshaller
- Parameters:
text
- the record text to unmarshal- Returns:
- the unmarshalled record object
- Throws:
RecordIOException
- if the record is malformed and cannot be parsed
-
marshal
public java.lang.String marshal(java.lang.Object record)
Description copied from interface:RecordMarshaller
Marshals a single record object to aString
.- Specified by:
marshal
in interfaceRecordMarshaller
- Parameters:
record
- the record object to marshal- Returns:
- the marshalled record text
-
marshal
public java.lang.String marshal(java.lang.String[] record)
Marshals aString
array into a CSV formatted record.- Parameters:
record
- theString[]
to marshal- Returns:
- the CSV formatted record
-
-