static void register(Class<? extends URLStreamHandler> handlerClass) {
    checkArgument("Handler".equals(handlerClass.getSimpleName()));

    String pkg = handlerClass.getPackage().getName();
    int lastDot = pkg.lastIndexOf('.');
    checkArgument(lastDot > 0, "package for Handler (%s) must have a parent package", pkg);

    String parentPackage = pkg.substring(0, lastDot);

    String packages = System.getProperty(JAVA_PROTOCOL_HANDLER_PACKAGES);
    if (packages == null) {
      packages = parentPackage;
    } else {
      packages += "|" + parentPackage;
    }
    System.setProperty(JAVA_PROTOCOL_HANDLER_PACKAGES, packages);
  }
Generic method that would allow registration of any properly placed {@code Handler} class.
jimfs/src/main/java/com/google/common/jimfs/Handler.java