public static void injectJavaScriptResourcesTogether(final String[] cpResourcePaths, final String[] filePaths, final String jsTagID,
      final Selenium se) {
    final ArrayList<InputStream> ins = new ArrayList<InputStream>();
    try {
      for (final String cpResourcePath : cpResourcePaths) {

        final InputStream in = JavascriptInjection.class.getResourceAsStream(cpResourcePath);
        if (in != null) {
          ins.add(in);
        }
      }

      for (final String filePath : filePaths) {
        final File f = new File(filePath).getAbsoluteFile().getCanonicalFile();
        final InputStream in = new FileInputStream(f);
        ins.add(in);
      }

      final SequenceInputStream sin = new SequenceInputStream(Collections.enumeration(ins));

      final String js = inputStream2UTF8(sin);

      se.addScript(js, jsTagID);

    } catch (final Throwable e) {
      if (RuntimeException.class.isInstance(e)) {
        throw RuntimeException.class.cast(e);
      } else {
        throw new RuntimeException(e);
      }
    } finally {
      for (final Closeable closer : ins) {
        try {
          closer.close();
        } catch (final Throwable e) {
        }
      }
    }
  }