public static String getResourceAsString(final String resourcePath) throws IOException {
    final InputStream stream = getResource(resourcePath);
    if (stream == null) {
      return null;
    }
    final ByteSource source =
        new ByteSource() {
          @Override
          public InputStream openStream() {
            return stream;
          }
        };
    return source.asCharSource(UTF_8).read();
  }
Utility class to load images from BinDiff package resources.
java/ui/src/main/java/com/google/security/zynamics/bindiff/utils/ResourceUtils.java