package picocli.codegen.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public final class Resources {

    public static List<String> slurpAll(String... resources) {
        List<String> result = new ArrayList<String>();
        for (String resource : resources) {
            result.add(slurp(resource));
        }
        return result;
    }

    public static String slurp(String resource) {
        try {
            return slurp(Resources.class.getResource(resource).openStream());
        } catch (IOException ex) {
            throw new IllegalStateException(ex);
        }
    }

    public static String slurp(InputStream in) {
        Scanner s = new Scanner(in).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }

    private Resources() {
        // utility class; don't instantiate
    }
}

@@ -24,16 +24,54 @@
 .util;%0A%0A
+import java.io.FileNotFoundException;%0A
 import j
@@ -118,16 +118,37 @@
 Stream;%0A
+import java.net.URL;%0A
 import j
@@ -572,21 +572,18 @@
     
-return slurp(
+URL url = 
 Reso
@@ -615,16 +615,150 @@
 esource)
+;%0A            if (url == null) %7B%0A                throw new FileNotFoundException(resource);%0A            %7D%0A            return slurp(url
 .openStr

improve error reporting