Class ServicesFile


  • public class ServicesFile
    extends Object
    A helper class for reading and writing Services files.
    See Also:
    ServiceLoader
    • Method Detail

      • getPath

        public static String getPath​(String serviceName)
        Returns an absolute path to a service file given the class name of the service.
        Parameters:
        serviceName - not null
        Returns:
        SERVICES_PATH + serviceName
      • readServiceFile

        public static Set<String> readServiceFile​(InputStream input)
                                           throws IOException
        Reads the set of service classes from a service file.
        Parameters:
        input - not null. Closed after use.
        Returns:
        a not null Set of service class names.
        Throws:
        IOException
      • writeServiceFile

        public static void writeServiceFile​(Collection<String> services,
                                            OutputStream output)
                                     throws IOException
        Writes the set of service class names to a service file.
        Parameters:
        output - not null. Not closed after use.
        services - a not null Collection of service class names.
        Throws:
        IOException