To note: You actually do know how many objects are in each deserializeStream (batchSize), so you could do a loop instead. Maybe it would look no cleaner, I just bring it up since now we are throwing several exceptions per file, rather than just one.