问题
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,RecordSeparatorPolicyor 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