Patch Set 1:

The problem with this is we have 3 almost identical methods, each of which does subtly different things, and they're already diverging. there's a mixture of int n and long n, and some arguments have final size and the others don't.

The only difference appears to be whether we write it into a temporary buffer, and what method gets called in the middle of the loop (fillInFromFile, fillInFromStream). We could parameterise that to the same function and delegate based on a switch (e.g. fillInFrom(FILE), fillInFrom(STREAM) and then code if( from==FILE)fillInFromFile() else (if from = STREAM) fillInFromStream() so we only need this implementation once. Or, we could pass in a class (FillInSource) and have that delegated to.

Either way, I think the duplicate looping logic should be removed so that when there's a future error, we only do it once, and it can be detected appropriately (and means we only have one place to fix in the future).