Reads contents of resource fully into a string.

@param resourceName resource name.
@param charset name of supported charset
@return entire contents of resource as string.
420688
public static String readResource(String resourceName, String charset) {
        InputStream is = Util.class.getResourceAsStream(resourceName);
        try {
            return read(is, charset);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            closeQuietly(is);
        }
    }
1045609
public static String readString(URL url, String charset) throws IORuntimeException {
		if (url == null) {
			throw new NullPointerException("Empty url provided!");
		}

		InputStream in = null;
		try {
			in = url.openStream();
			return IoUtil.read(in, charset);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		} finally {
			IoUtil.close(in);
		}
	}
637162
@Override
	public String load(String resource, String[] paths, String charset) throws IOException {
		for (ResourceLoader loader : loaders) {
			if (loader.exists(resource, paths)) {
				return loader.load(resource, paths, charset);
			}
		}
		throw new IOException("No such file " + resource);
	}
605153
public static String decode(String content, Charset charset) {
		if (null == charset) {
			charset = CharsetUtil.defaultCharset();
		}
		return decode(content, charset.name());
	}
829382
@Nonnull
    public static String readFile(@Nonnull File file, @Nonnull String charset) throws IOException {
        return readFile(file, Charset.forName(charset));
    }
8697
public static String readString(String path, Charset charset) throws IORuntimeException {
		return readString(file(path), charset);
	}
666618
public static InputStream toStream(String content, Charset charset) {
        byte[] bytes = content.getBytes(charset);
        return new ByteArrayInputStream(bytes);
    }
479193
public String readString(URI uri, Charset charset) {
    return searchForSupportedProcessor(uri).readString(uri, charset);
  }
1244001
public static String encode(byte[] source, String charset) {
		return StrUtil.str(encode(source, false), charset);
	}
307117
public static String request(HttpUriRequest httpUriRequest,
            String charSetName) {
        return request(httpUriRequest, Charset.forName(charSetName));
    }
1186839
public static String getResponseAsString(String uri, String charsetName) {
        return HttpRequester.getResponseAsString(uri, charsetName);
    }
1129370
public static String readContentAsString(URL url, String encoding) {
        try {
            return readContentAsString(url.openStream(), encoding);
        } catch (IOException e) {
            throw E.ioException(e);
        }
    }
505433
public static List<String> readLinesWithRestOrFilePathOrClasspath(
            String resourceWithRestOrFilePathOrClasspath, String charsetName) {
        return JMCollections
                .buildListByLine(getStringWithRestOrClasspathOrFilePath(
                        resourceWithRestOrFilePathOrClasspath, charsetName));
    }
1164900
public static ImmutableSet<String> loadStringSet(final CharSource source) throws IOException {
    return ImmutableSet.copyOf(loadStringList(source));
  }
1101997
public static CharSource asCharSource(final Class<?> contextClass, final String resourceName, final Charset charset) {
		return new CharSource() {
			@Override public Reader openStream() throws IOException {
				return asReader(checkNotNull(contextClass).getResourceAsStream(checkNotEmpty(resourceName)), checkNotNull(charset));
			}
		};
	}
319970
@Nonnull
	public static String readInputStreamToString(@Nonnull final InputStream inputStream, @Nonnull final Charset charset)
			throws IOException {
		final BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
		final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
		int result = bufferedInputStream.read();
		while (result != -1) {
			byteArrayOutputStream.write((byte) result);
			result = bufferedInputStream.read();
		}
		return byteArrayOutputStream.toString(checkNonEmptyArgument(charset, "charset").name());
	}
713113
@Override
	public Reader getResource(String resourceName) throws ResourceNotFoundException {

		return getResource(null, resourceName, false);
	}