Camel CSVRecord Camel Bindy [英] Camel CSVRecord Camel Bindy

查看:30
本文介绍了Camel CSVRecord Camel Bindy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 bindy (2.16.0) 的骆驼来解析 csv 文件.该文件包含一个页眉和一个页脚.两者都用作元数据来描述所有其他记录的通用数据.(客户定义,因此我无法更改 CSV 格式)

I'm using camel with bindy (2.16.0) to parse a csv file. The file contains a header and a footer. Both are used as metadata to describe common data for all other records. (Customer defined so I cant change the CSV Format)

我正在使用 Bindy 为我解析数据.我遇到的问题是,对于 CSVRecord,您不能排除页脚.我可以跳过页眉,但数据解析失败,因为它无法解析页脚,因为数据格式不同.

Im using Bindy to parse the data for me. The issue that I'm having is that for CSVRecord you cannot exclude the footer. I'm able to skip the header but the parsing of the data fails because it cannot parse the footer since the data format is different.

有没有办法从 CSVRecord bindy 中排除最后一行/页脚,或者用其他方式读取并删除最后一行?

Is there a way to exclude the last line/footer from CSVRecord bindy or maybe have camel read and remove the last line in another way?

推荐答案

不,目前 bindy 不支持这个.在您的情况下,页脚是否只有一行?或者它是否有任何特殊的前导标记来指示其页脚?

No this is currently not supported in bindy. Is the footer in your case a single line only? Or does it have any special leading marker to indicate its a footer?

我们也许可以改进 bindy 以支持跳过页脚.因此,默认情况下页脚可能只是最后一行.但只是想知道人们是否可以有多行作为页脚?

We could maybe improve bindy to support skipping footer. So maybe a footer by default is just the last line. But just wonder if people may have multiple lines as footer?

在使用 bindy 解析它之前,您需要自己手动删除最后一行.如果文件不大,并且可以将其保存在内存中,则可以使用 Camel 处理器/bean 并从消息正文中删除最后一行.

You would need to manually remove that last line yourself before parsing it with bindy. If the file is not big, and you can have it in memory you can use a Camel processor / bean and remove the last line from the message body.

这篇关于Camel CSVRecord Camel Bindy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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