I'm not quite sure what you want to do with different files. If the idea is to use them as database tables, and you have several keys with attached information scattered across several files, you may need to look at something like MapReduce , where you first create a piece of information from each file and Combine information sharing the same key in the second step.
As for data structures, it depends on the location of your files. I will probably have a special reader for each type of file that will store information in dedicated data structures representing the information in the file. You can attach a key to each information and use the reduction operation to combine all pieces of information using the same key and combine them into a proxy structure.
On the other hand, if the idea is to create identical objects from different serialization methods (i.e. different files are independent, but represent the same data type with a different layout), without knowing in advance which serialization method was used , I am afraid that the only solution left before this is to force the removal of deserialization. You may have a set of readers, one for each input type, and try to analyze the file, if it fails, the next one starts, and so on, until you find a new file format or find a suitable reader. I do not think that there is any pattern.
Thibaut
source share