public static String getText(String filename, Class source)
    {
        int nb;
        char[] buffer = new char[1024];

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    source.getResource(filename).openStream()));
            StringBuffer res = new StringBuffer();

            while ((nb = reader.read(buffer, 0, 1024)) >= 0) {
                res.append(buffer, 0, nb);
            }

            return res.toString();
        } catch (IOException e) {
            System.err.println(e);
        } catch (NullPointerException e) {
            return null;
        }

        return null;
    }