Spring Batch process a one 10gb line into separate items

一笑奈何 提交于 2019-12-24 03:38:06

问题


I have implemented a spring-batch job to process a 10gb file with one item per file and it works great!

But the client just changed it to make it a 10gb file with one single line with all items on it separated by size. Where the size are the first 4 digits of the text which on top of it all is in EBCDIC so I need to translate it into as well.

An example would be:

0020aaaaaaaaaaaaaaaaaaa0010xxxxxxxxx0021aaaaaaaaaaaaaaaaaaay0009xxxxxxxx1aaaaaaa

and so on for 10GB worth of text

I have a couple problems with this change...

  • I will need a lot of memory now, spring data reads the whole line before processing and possibly splitting it with a LineMapper, RecordSeparatorPolicy or something
  • My logs will fail to display the line error as they did before

Is there any implemetation of ItemReader<String> that can handle a situation like this?

Is there a way in Spring batch to read chars instead of lines? Without having to implement my very own FlatFileItemReader that reads 4 chars then a length and so on?

P.S: I would rather not pre-process the file into the old format.

来源:https://stackoverflow.com/questions/32318301/spring-batch-process-a-one-10gb-line-into-separate-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!