In order to have it "automated" you need somehow to know which type of content you have in your binary file.
If you are the one creating the binary files, one method would be to add a field at the top of the file, describing the type of data in it - then your parser can know how to parse it.
If you are not the author of the binaries, maybe you can rename the files with different extensions.
But you must know in some way how to read the file - since binary data is nothing more then ones and zeroes which can mean anything.