Spring批处理-使用多个字符作为分隔符
我有一个分隔符为“||”的输入文件。
正如您所看到的,有两个字符,但批处理接受单个字符作为分隔符。
这个问题该怎么办呢??
Jira 中的问题 Batch-591 显示为已解决 - 是否可以使用多个字符作为分隔符??
谢谢, 尼克
I have a input file with delimiter as "||".
As you can see there are two characters but batch accepts a single character as delimiter.
How to go about this issue??
Issue Batch-591 in Jira shows as resolved -- Is it possible to use multiple characters as delimiter ??
Thanks,
Nik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
引用的问题已解决为无法修复。这意味着他们没有看到这个问题的必要性。
但我想您建议实现自己的 Tokenizer 类(可能扩展
AbstractLineTokenizer
),使用解决方法策略 喜欢这个。The referenced issue is resolved as wont-fix. This means they don't see the necessity of this issue.
But I guess you are recommended to implement your own Tokenizer class (probably extending
AbstractLineTokenizer
), using a workaround strategy like this one.org.springframework.batch.item.file.transform.DelimitedLineTokenizer
有两个构造函数:DelimitedLineTokenizer()
是分隔符为逗号的常见情况的默认构造函数,并且是针对单个角色自动调用。当分隔符是多个字符时,使用
DelimitedLineTokenizer(java.lang.String delimiter)
。在
constructor-arg
类型中指定java.lang.String
。org.springframework.batch.item.file.transform.DelimitedLineTokenizer
has two constructors :DelimitedLineTokenizer()
is the default constructor for the common case where the delimiter is a comma and is invoked automatically for a single character.DelimitedLineTokenizer(java.lang.String delimiter)
is used when the delimiter is of multiple characters.Specify
java.lang.String
inconstructor-arg
type.嗨,皮特,它真的对我有用
我必须添加这个字符“::”作为分隔符,这是设置的 DelimitedLineTokenizer bean
Hi Pete it really works for me
I had to add this char "::" as a delimiter , this is the DelimitedLineTokenizer bean set up