public static String resourceToString(String name) {
		InputStream input = Monarchy.class.getResourceAsStream("/" + name);
		Writer writer = new StringWriter();
		char[] buffer = new char[1024];

		if (input != null) {
			try {
				int n;
				Reader reader = new BufferedReader(new InputStreamReader(input));
				while ((n = reader.read(buffer)) != -1)
					writer.write(buffer, 0, n);
			} catch (IOException e) {
				try {
					input.close();
				} catch (IOException ex) {
				}
				return null;
			} finally {
				try {
					input.close();
				} catch (IOException e) {
				}
			}
		} else {
			return null;
		}

		String text = writer.toString().trim();
		text = text.replace("\r\n", " ").replace("\n", " ");
		return text.trim();
	}