Announcement Announcement Module
No announcement yet.
Zipped FlatFileItemReader Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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,
    Last edited by ChrLipp; Apr 26th, 2010, 05:54 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.