code: @SuppressWarnings("unchecked") // safe covariant cast
    public static ImmutableSet<OpenOption> getOptionsForInputStream(OpenOption... options) {
      boolean nofollowLinks = false;
      for (OpenOption option : options) {
        if (checkNotNull(option) != READ) {
          if (option == LinkOption.NOFOLLOW_LINKS) {
            nofollowLinks = true;
          } else {
            throw new UnsupportedOperationException("'" + option + "' not allowed");
          }
        }
      }
  
      // just return the link options for finding the file, nothing else is needed
      return (ImmutableSet<OpenOption>)
          (ImmutableSet<?>) (nofollowLinks ? NOFOLLOW_LINKS : FOLLOW_LINKS);
    }
docs: Returns an immutable set of open options for opening a new input stream.