static Set<String> readServiceFile(InputStream input) throws IOException {
    HashSet<String> serviceClasses = new HashSet<String>();
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, UTF_8))) {
      String line;
      while ((line = reader.readLine()) != null) {
        int commentStart = line.indexOf('#');
        if (commentStart >= 0) {
          line = line.substring(0, commentStart);
        }
        line = line.trim();
        if (!line.isEmpty()) {
          serviceClasses.add(line);
        }
      }
      return serviceClasses;
    }
  }
Reads the set of service classes from a service file.

@param input not {@code null}. Closed after use.
@return a not {@code null Set} of service class names.
@throws IOException
service/processor/src/main/java/com/google/auto/service/processor/ServicesFiles.java