-
Apr 26th, 2010, 05:48 AM
#1
Zipped FlatFileItemReader
I am new to Spring Batch and try to learn by converting existing batches to Spring Batch. However I think my question has nothing to do with Spring Batch but is a general Spring Question.
When I want to read a compressed text file I assume that the FlatFileItemReader doesn't care. It just needs a Reader from a BufferedReaderFactory. So in that case I have to provide my own version of a BufferedReaderFactory, which will provide a buffered reader from an GZIPInputStream for example.
Is this correct or are there better solutions? What if the BufferedReaderFactory is not able to choose the Reader type (for example no file extension available)?
Thanks for your help,
CL
Last edited by ChrLipp; Apr 26th, 2010 at 05:54 AM.
-
Apr 27th, 2010, 11:13 AM
#2
As far as I know that is the best solution. If you don't know the file type you have a problem though. There are magic numbers in the file header that will tell you, but I don't know any Java APIs that interrogate them directly (which is not to say that such an API does not exist). You could try reading the file with a variety of compression types until you find one that works, I suppose.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules