# Class ServicesFile (5.0.3)

    public class ServicesFile

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

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> ServicesFile

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Fields

### SERVICES_PATH

    public static final String SERVICES_PATH

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

## 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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` not `null` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | 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` | `https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html` not `null`. Closed after use. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Set.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` | a not `null Set` of service class names. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### 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` | `https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` a not `null Collection` of service class names. |
| `output` | `https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html` not `null`. Not closed after use. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |