Package ddf.catalog.transformer.csv
Class CsvQueryResponseTransformer
java.lang.Object
ddf.catalog.transformer.csv.CsvQueryResponseTransformer
- All Implemented Interfaces:
ddf.catalog.transform.QueryResponseTransformer
public class CsvQueryResponseTransformer
extends Object
implements ddf.catalog.transform.QueryResponseTransformer
An implementation of QueryResponseTransformer that produces CSV output.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionddf.catalog.data.BinaryContenttransform(ddf.catalog.operation.SourceResponse upstreamResponse, Map<String, Serializable> arguments)
-
Constructor Details
-
CsvQueryResponseTransformer
public CsvQueryResponseTransformer()
-
-
Method Details
-
transform
public ddf.catalog.data.BinaryContent transform(ddf.catalog.operation.SourceResponse upstreamResponse, Map<String, Serializable> arguments) throws ddf.catalog.transform.CatalogTransformerException- Specified by:
transformin interfaceddf.catalog.transform.QueryResponseTransformer- Parameters:
upstreamResponse- the SourceResponse to be converted.arguments- this transformer accepts 2 parameters in the 'arguments' map.- key: 'columnOrder' value: a
Listof attribute names (as strings) that specifies the order in which the columns will appear in the output. - key: 'aliases' value: a
Mapwith keys that are attribute names and with values that are the corresponding column headers that will be printed in the output. For example, if the key is 'title' and the value is 'Product' then the resulting CSV will have a column name of 'Product' instead of 'title'.
- key: 'columnOrder' value: a
- Returns:
- a BinaryContent object that contains an InputStream with the CSV content.
- Throws:
ddf.catalog.transform.CatalogTransformerException- during processing, the CSV output is written to an Appendable, whose 'append()' method signature declares that it throws IOException. When that Appendable throws IOException, this class will theoretically convert that into a CatalogTransformerException and raise that. Because this implementation uses a StringBuilder which doesn't throw IOException, this will never occur.
-