Class ServicesFile (2.0.0)

public class ServicesFile

A helper class for reading and writing Services files. See Also: java.util.ServiceLoader

Inheritance

java.lang.Object > ServicesFile

Static Fields

SERVICES_PATH

public static final String SERVICES_PATH
Field Value
TypeDescription
String

Static Methods

getPath(String serviceName)

public static String getPath(String serviceName)

Returns an absolute path to a service file given the class name of the service.

Parameter
NameDescription
serviceNameString

not null

Returns
TypeDescription
String

SERVICES_PATH + serviceName

readServiceFile(InputStream input)

public static Set<String> readServiceFile(InputStream input)

Reads the set of service classes from a service file.

Parameter
NameDescription
inputInputStream

not null. Closed after use.

Returns
TypeDescription
Set<String>

a not null Set of service class names.

Exceptions
TypeDescription
IOException

writeServiceFile(Collection<String> services, OutputStream output)

public static void writeServiceFile(Collection<String> services, OutputStream output)

Writes the set of service class names to a service file.

Parameters
NameDescription
servicesCollection<String>

a not null Collection of service class names.

outputOutputStream

not null. Not closed after use.

Exceptions
TypeDescription
IOException