Avoiding massive memory consumption with File.listFiles()