Java Apache camel逐行分割csv

Java Apache camel逐行分割csv,java,csv,apache-camel,Java,Csv,Apache Camel,我正在尝试对.csv文件进行一些转换。我现在的代码是 CsvDataFormat csv = new CsvDataFormat(); from("file:/pathToFile") .unmarshal(csv) .convertBodyTo(List.class) .process(new CsvParserProcess()) .marshal(csv) .to("file:/pathToOut").log("Finished Trans

我正在尝试对
.csv
文件进行一些转换。我现在的代码是

CsvDataFormat csv = new CsvDataFormat();

    from("file:/pathToFile")
    .unmarshal(csv)
    .convertBodyTo(List.class)
    .process(new CsvParserProcess())
    .marshal(csv)
    .to("file:/pathToOut").log("Finished Transformation").end();
这是可行的,但我认为这会将整个文件加载到内存(?)中,我现在想逐行分割它,所以我尝试了

CsvDataFormat csv = new CsvDataFormat();

    from("file:/pathToFile")
    .unmarshal(csv)
    .split(body().tokenize("/n")).streaming()
    .process(new CsvParserProcess())
    .marshal(csv)
    .to("file:/pathToOut").log("Finished Transformation").end();
但是,我得到了一个错误
没有类型转换器可用于将type:java.lang.String转换为所需的type:java.util.List,并带有值…
,以及附带的处理器类

public void process(Exchange exchange) throws Exception {
    System.out.println(exchange.getIn().getBody());
}
打印出来的

[[data0,data1, .... , dataN], [data0,....,dataN],...,[data0,...,dataN]]
在stacktrace之后。我真的不明白为什么我会得到类型转换?我做错了什么


编辑:我忘记了sysout输出中的几个括号

当我解封csv时切换顺序修复了我的问题代码现在是

CsvDataFormat csv = new CsvDataFormat();

from("file:/pathToFile")
.split(body().tokenize("/n")).streaming()
.unmarshal(csv)
.process(new CsvParserProcess())
.marshal(csv)
.to("file:/pathToOut").log("Finished Transformation").end();