Camel:如何跳过 CSV 文件中的多个标题行 [英] Camel: How to skip multiple header lines in CSV files

查看:45
本文介绍了Camel:如何跳过 CSV 文件中的多个标题行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用 Apache Camel 处理 CSV 文件.我的文件有多个标题行.在 Camel 中,我只找到 skipFirstLineskipHeaderRecord(这对我来说不清楚)但是如何跳过不止一行?

I'm going to process CSV files using Apache Camel. My files have multiple header lines. In Camel I only find skipFirstLine or skipHeaderRecord (which is not clear for me) but how to skip more than one line?

推荐答案

在处理 body 之前,您可以在 body 上使用 tokenize 方法.

You can use tokenize method on your body before processing the body.

tokenize(String token, int group, boolean skipFirst)

示例:

`from("filePath").
    split(body().tokenize("\n",1,true)).
    streaming().
    process(exchange -> {....}).
to("filePath");`

这篇关于Camel:如何跳过 CSV 文件中的多个标题行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆