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
Type Description
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
Name Description
serviceName String

not null

Returns
Type Description
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
Name Description
input InputStream

not null. Closed after use.

Returns
Type Description
Set<String>

a not null Set of service class names.

Exceptions
Type Description
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
Name Description
services Collection<String>

a not null Collection of service class names.

output OutputStream

not null. Not closed after use.

Exceptions
Type Description
IOException