public class Csv
extends java.lang.Object
Optional CSV encoder/parser implementation based on the [OpenCSV](http://opencsv.sourceforge.net/) library. It will be available when the OpenCsv library is on the classpath (an optional dependency).
Modifier and Type | Class and Description |
---|---|
static class |
Csv.Context |
Modifier and Type | Field and Description |
---|---|
static java.util.function.Supplier<java.util.function.BiConsumer<ChainedHttpConfig,ToServer>> |
encoderSupplier |
static java.util.function.Supplier<java.util.function.BiFunction<ChainedHttpConfig,FromServer,java.lang.Object>> |
parserSupplier |
Constructor and Description |
---|
Csv() |
Modifier and Type | Method and Description |
---|---|
static void |
encode(ChainedHttpConfig config,
ToServer ts)
Used to encode the request content using the OpenCsv writer.
|
static java.lang.Object |
parse(ChainedHttpConfig config,
FromServer fromServer)
Used to parse the server response content using the OpenCsv parser.
|
static void |
toCsv(HttpConfig delegate,
char separator)
Used to configure the OpenCsv encoder/parser in the configuration context for the
text/csv content-type. |
static void |
toCsv(HttpConfig delegate,
char separator,
char quote)
Used to configure the OpenCsv encoder/parser in the configuration context for the
text/csv content-type. |
static void |
toCsv(HttpConfig delegate,
java.lang.String contentType,
java.lang.Character separator,
java.lang.Character quote)
Used to configure the OpenCsv encoder/parser in the configuration context for the specified content type.
|
static void |
toTsv(HttpConfig delegate,
char quote)
Used to configure the OpenCsv encoder/parser in the configuration context for the
text/tab-separated-values content type, with a tab as the
column separator character. |
public static final java.util.function.Supplier<java.util.function.BiConsumer<ChainedHttpConfig,ToServer>> encoderSupplier
public static final java.util.function.Supplier<java.util.function.BiFunction<ChainedHttpConfig,FromServer,java.lang.Object>> parserSupplier
public static java.lang.Object parse(ChainedHttpConfig config, FromServer fromServer)
Used to parse the server response content using the OpenCsv parser.
config
- the configurationfromServer
- the server content accessorpublic static void encode(ChainedHttpConfig config, ToServer ts)
Used to encode the request content using the OpenCsv writer.
config
- the configurationts
- the server request content accessorpublic static void toCsv(HttpConfig delegate, java.lang.String contentType, java.lang.Character separator, java.lang.Character quote)
Used to configure the OpenCsv encoder/parser in the configuration context for the specified content type.
delegate
- the configuration objectcontentType
- the content type to be registeredseparator
- the CSV column separator characterquote
- the CSV quote characterpublic static void toCsv(HttpConfig delegate, char separator)
Used to configure the OpenCsv encoder/parser in the configuration context for the text/csv
content-type. No quote character will be provided.
delegate
- the configuration objectseparator
- the CSV column separator characterpublic static void toCsv(HttpConfig delegate, char separator, char quote)
Used to configure the OpenCsv encoder/parser in the configuration context for the text/csv
content-type.
delegate
- the configuration objectseparator
- the CSV column separator characterquote
- the CSV quote characterpublic static void toTsv(HttpConfig delegate, char quote)
Used to configure the OpenCsv encoder/parser in the configuration context for the text/tab-separated-values
content type, with a tab as the
column separator character.
delegate
- the configuration objectquote
- the quote character to be used