# FileSystem

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Protected Ctors](https://developer.android.com/reference/java/nio/file/FileSystem#proctors)\|[Methods](https://developer.android.com/reference/java/nio/file/FileSystem#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/nio/file/FileSystem#inhmethods)  

# FileSystem

`
public


abstract
class
FileSystem
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Closeable](https://developer.android.com/reference/java/io/Closeable)`


`

|---|--------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.nio.file.FileSystem |

<br />

*** ** * ** ***

Provides an interface to a file system and is the factory for objects to access files and other objects in the file system.

The default file system, obtained by invoking the[FileSystems.getDefault](https://developer.android.com/reference/java/nio/file/FileSystems#getDefault())method, provides access to the file system that is accessible to the Java virtual machine. The[FileSystems](https://developer.android.com/reference/java/nio/file/FileSystems)class defines methods to create file systems that provide access to other types of (custom) file systems.

A file system is the factory for several types of objects:

- The[getPath](https://developer.android.com/reference/java/nio/file/FileSystem#getPath(java.lang.String,%20java.lang.String[]))method converts a system dependent*path string* , returning a[Path](https://developer.android.com/reference/java/nio/file/Path)object that may be used to locate and access a file.

- The[getPathMatcher](https://developer.android.com/reference/java/nio/file/FileSystem#getPathMatcher(java.lang.String))method is used to create a[PathMatcher](https://developer.android.com/reference/java/nio/file/PathMatcher)that performs match operations on paths.

- The[getFileStores](https://developer.android.com/reference/java/nio/file/FileSystem#getFileStores())method returns an iterator over the underlying[file-stores](https://developer.android.com/reference/java/nio/file/FileStore).

- The[getUserPrincipalLookupService](https://developer.android.com/reference/java/nio/file/FileSystem#getUserPrincipalLookupService())method returns the[UserPrincipalLookupService](https://developer.android.com/reference/java/nio/file/attribute/UserPrincipalLookupService)to lookup users or groups by name.

- The[newWatchService](https://developer.android.com/reference/java/nio/file/FileSystem#newWatchService())method creates a[WatchService](https://developer.android.com/reference/java/nio/file/WatchService)that may be used to watch objects for changes and events.

File systems vary greatly. In some cases the file system is a single hierarchy of files with one top-level root directory. In other cases it may have several distinct file hierarchies, each with its own top-level root directory. The[getRootDirectories](https://developer.android.com/reference/java/nio/file/FileSystem#getRootDirectories())method may be used to iterate over the root directories in the file system. A file system is typically composed of one or more underlying[file-stores](https://developer.android.com/reference/java/nio/file/FileStore)that provide the storage for the files. Theses file stores can also vary in the features they support, and the file attributes or*meta-data*that they associate with files.

A file system is open upon creation and can be closed by invoking its[close](https://developer.android.com/reference/java/nio/file/FileSystem#close())method. Once closed, any further attempt to access objects in the file system cause[ClosedFileSystemException](https://developer.android.com/reference/java/nio/file/ClosedFileSystemException)to be thrown. File systems created by the default[provider](https://developer.android.com/reference/java/nio/file/spi/FileSystemProvider)cannot be closed.

A`FileSystem`can provide read-only or read-write access to the file system. Whether or not a file system provides read-only access is established when the`FileSystem`is created and can be tested by invoking its[isReadOnly](https://developer.android.com/reference/java/nio/file/FileSystem#isReadOnly())method. Attempts to write to file stores by means of an object associated with a read-only file system throws[ReadOnlyFileSystemException](https://developer.android.com/reference/java/nio/file/ReadOnlyFileSystemException).

File systems are safe for use by multiple concurrent threads. The[close](https://developer.android.com/reference/java/nio/file/FileSystem#close())method may be invoked at any time to close a file system but whether a file system is*asynchronously closeable* is provider specific and therefore unspecified. In other words, if a thread is accessing an object in a file system, and another thread invokes the`close`method then it may require to block until the first operation is complete. Closing a file system causes all open channels, watch services, and other[closeable](https://developer.android.com/reference/java/io/Closeable)objects associated with the file system to be closed.

## Summary

|                                                            ### Protected constructors                                                            ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[FileSystem](https://developer.android.com/reference/java/nio/file/FileSystem#FileSystem())`() ` Initializes a new instance of this class. |

|                                                                                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void`                                                                                                                                                     | ` `[close](https://developer.android.com/reference/java/nio/file/FileSystem#close())`() ` Closes this file system.                                                                                                                                                                                                                                                                                              |
| ` abstract `[Iterable](https://developer.android.com/reference/java/lang/Iterable)`<`[FileStore](https://developer.android.com/reference/java/nio/file/FileStore)`>` | ` `[getFileStores](https://developer.android.com/reference/java/nio/file/FileSystem#getFileStores())`() ` Returns an object to iterate over the underlying file stores.                                                                                                                                                                                                                                         |
| ` abstract `[Path](https://developer.android.com/reference/java/nio/file/Path)                                                                                       | ` `[getPath](https://developer.android.com/reference/java/nio/file/FileSystem#getPath(java.lang.String,%20java.lang.String[]))`(`[String](https://developer.android.com/reference/java/lang/String)` first, `[String...](https://developer.android.com/reference/java/lang/String)` more) ` Converts a path string, or a sequence of strings that when joined form a path string, to a`Path`.                   |
| ` abstract `[PathMatcher](https://developer.android.com/reference/java/nio/file/PathMatcher)                                                                         | ` `[getPathMatcher](https://developer.android.com/reference/java/nio/file/FileSystem#getPathMatcher(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` syntaxAndPattern) ` Returns a`PathMatcher`that performs match operations on the`String`representation of[Path](https://developer.android.com/reference/java/nio/file/Path)objects by interpreting a given pattern. |
| ` abstract `[Iterable](https://developer.android.com/reference/java/lang/Iterable)`<`[Path](https://developer.android.com/reference/java/nio/file/Path)`>`           | ` `[getRootDirectories](https://developer.android.com/reference/java/nio/file/FileSystem#getRootDirectories())`() ` Returns an object to iterate over the paths of the root directories.                                                                                                                                                                                                                        |
| ` abstract `[String](https://developer.android.com/reference/java/lang/String)                                                                                       | ` `[getSeparator](https://developer.android.com/reference/java/nio/file/FileSystem#getSeparator())`() ` Returns the name separator, represented as a string.                                                                                                                                                                                                                                                    |
| ` abstract `[UserPrincipalLookupService](https://developer.android.com/reference/java/nio/file/attribute/UserPrincipalLookupService)                                 | ` `[getUserPrincipalLookupService](https://developer.android.com/reference/java/nio/file/FileSystem#getUserPrincipalLookupService())`() ` Returns the`UserPrincipalLookupService`for this file system*(optional operation)*.                                                                                                                                                                                    |
| ` abstract boolean`                                                                                                                                                  | ` `[isOpen](https://developer.android.com/reference/java/nio/file/FileSystem#isOpen())`() ` Tells whether or not this file system is open.                                                                                                                                                                                                                                                                      |
| ` abstract boolean`                                                                                                                                                  | ` `[isReadOnly](https://developer.android.com/reference/java/nio/file/FileSystem#isReadOnly())`() ` Tells whether or not this file system allows only read-only access to its file stores.                                                                                                                                                                                                                      |
| ` abstract `[WatchService](https://developer.android.com/reference/java/nio/file/WatchService)                                                                       | ` `[newWatchService](https://developer.android.com/reference/java/nio/file/FileSystem#newWatchService())`() ` Constructs a new[WatchService](https://developer.android.com/reference/java/nio/file/WatchService)*(optional operation)*.                                                                                                                                                                         |
| ` abstract `[FileSystemProvider](https://developer.android.com/reference/java/nio/file/spi/FileSystemProvider)                                                       | ` `[provider](https://developer.android.com/reference/java/nio/file/FileSystem#provider())`() ` Returns the provider that created this file system.                                                                                                                                                                                                                                                             |
| ` abstract `[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                     | ` `[supportedFileAttributeViews](https://developer.android.com/reference/java/nio/file/FileSystem#supportedFileAttributeViews())`() ` Returns the set of the[names](https://developer.android.com/reference/java/nio/file/attribute/AttributeView#name())of the file attribute views supported by this`FileSystem`.                                                                                             |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[java.io.Closeable](https://developer.android.com/reference/java/io/Closeable)` ` |------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](https://developer.android.com/reference/java/io/Closeable#close())`() ` Closes this stream and releases any system resources associated with it. | ||
| From interface` `[java.lang.AutoCloseable](https://developer.android.com/reference/java/lang/AutoCloseable)` ` |------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](https://developer.android.com/reference/java/lang/AutoCloseable#close())`() ` Closes this resource, relinquishing any underlying resources. | ||

## Protected constructors

### FileSystem

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected FileSystem ()
```

Initializes a new instance of this class.

<br />

## Public methods

### close

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract void close ()
```

Closes this file system.

After a file system is closed then all subsequent access to the file system, either by methods defined by this class or on objects associated with this file system, throw[ClosedFileSystemException](https://developer.android.com/reference/java/nio/file/ClosedFileSystemException). If the file system is already closed then invoking this method has no effect.

Closing a file system will close all open[channels](https://developer.android.com/reference/java/nio/channels/Channel),[directory-streams](https://developer.android.com/reference/java/nio/file/DirectoryStream),[watch-service](https://developer.android.com/reference/java/nio/file/WatchService), and other closeable objects associated with this file system. The[default](https://developer.android.com/reference/java/nio/file/FileSystems#getDefault())file system cannot be closed.

<br />

|                                                                             Throws                                                                              ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                                       | If an I/O error occurs                        |
| [UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException) | Thrown in the case of the default file system |

### getFileStores

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Iterable<FileStore> getFileStores ()
```

Returns an object to iterate over the underlying file stores.

The elements of the returned iterator are the[FileStores](https://developer.android.com/reference/java/nio/file/FileStore)for this file system. The order of the elements is not defined and the file stores may change during the lifetime of the Java virtual machine. When an I/O error occurs, perhaps because a file store is not accessible, then it is not returned by the iterator.

In the case of the default provider, and a security manager is installed, the security manager is invoked to check[RuntimePermission](https://developer.android.com/reference/java/lang/RuntimePermission)`("getFileStoreAttributes")`. If denied, then no file stores are returned by the iterator. In addition, the security manager's[SecurityManager.checkRead(String)](https://developer.android.com/reference/java/lang/SecurityManager#checkRead(java.lang.String))method is invoked to check read access to the file store's*top-most*directory. If denied, the file store is not returned by the iterator. It is system dependent if the permission checks are done when the iterator is obtained or during iteration.

**Usage Example:**Suppose we want to print the space usage for all file stores:  

```
     for (FileStore store: FileSystems.getDefault().getFileStores()) {
         long total = store.getTotalSpace() / 1024;
         long used = (store.getTotalSpace() - store.getUnallocatedSpace()) / 1024;
         long avail = store.getUsableSpace() / 1024;
         System.out.format("%-20s %12d %12d %12d%n", store, total, used, avail);
     }
 
```

<br />

<br />

|                                                                                                      Returns                                                                                                       ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| [Iterable](https://developer.android.com/reference/java/lang/Iterable)`<`[FileStore](https://developer.android.com/reference/java/nio/file/FileStore)`>` | An object to iterate over the backing file stores <br /> |

### getPath

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Path getPath (String first, 
                String... more)
```

Converts a path string, or a sequence of strings that when joined form a path string, to a`Path`. If`more`does not specify any elements then the value of the`first`parameter is the path string to convert. If`more`specifies one or more elements then each non-empty string, including`first`, is considered to be a sequence of name elements (see[Path](https://developer.android.com/reference/java/nio/file/Path)) and is joined to form a path string. The details as to how the Strings are joined is provider specific but typically they will be joined using the[name-separator](https://developer.android.com/reference/java/nio/file/FileSystem#getSeparator())as the separator. For example, if the name separator is "`/`" and`getPath("/foo","bar","gus")`is invoked, then the path string`"/foo/bar/gus"`is converted to a`Path`. A`Path`representing an empty path is returned if`first`is the empty string and`more`does not contain any non-empty strings.

The parsing and conversion to a path object is inherently implementation dependent. In the simplest case, the path string is rejected, and[InvalidPathException](https://developer.android.com/reference/java/nio/file/InvalidPathException)thrown, if the path string contains characters that cannot be converted to characters that are*legal* to the file store. For example, on UNIX systems, the NUL (\\u0000) character is not allowed to be present in a path. An implementation may choose to reject path strings that contain names that are longer than those allowed by any file store, and where an implementation supports a complex path syntax, it may choose to reject path strings that are*badly formed*.

In the case of the default provider, path strings are parsed based on the definition of paths at the platform or virtual file system level. For example, an operating system may not allow specific characters to be present in a file name, but a specific underlying file store may impose different or additional restrictions on the set of legal characters.

This method throws[InvalidPathException](https://developer.android.com/reference/java/nio/file/InvalidPathException)when the path string cannot be converted to a path. Where possible, and where applicable, the exception is created with an[index](https://developer.android.com/reference/java/nio/file/InvalidPathException#getIndex())value indicating the first position in the`path`parameter that caused the path string to be rejected.

<br />

|                                    Parameters                                     ||
|---------|--------------------------------------------------------------------------|
| `first` | `String`: the path string or initial part of the path string <br />      |
| `more`  | `String`: additional strings to be joined to form the path string <br /> |

|                                            Returns                                             ||
|--------------------------------------------------------------------|----------------------------|
| [Path](https://developer.android.com/reference/java/nio/file/Path) | the resulting`Path` <br /> |

|                                                                   Throws                                                                   ||
|----------------------------------------------------------------------------------------------------|----------------------------------------|
| [InvalidPathException](https://developer.android.com/reference/java/nio/file/InvalidPathException) | If the path string cannot be converted |

### getPathMatcher

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract PathMatcher getPathMatcher (String syntaxAndPattern)
```

Returns a`PathMatcher`that performs match operations on the`String`representation of[Path](https://developer.android.com/reference/java/nio/file/Path)objects by interpreting a given pattern. The`syntaxAndPattern`parameter identifies the syntax and the pattern and takes the form:
>
> ```
>  syntax:pattern
>  
> ```
where`':'`stands for itself.

A`FileSystem`implementation supports the "`glob`" and "`regex`" syntaxes, and may support others. The value of the syntax component is compared without regard to case.

When the syntax is "`glob`" then the`String`representation of the path is matched using a limited pattern language that resembles regular expressions but with a simpler syntax. For example:

|     Example      |                              Description                               |
|     `*.java`     |      Matches a path that represents a file name ending in`.java`       |
|      `*.*`       |                  Matches file names containing a dot                   |
| `*.{java,class}` |            Matches file names ending with`.java`or`.class`             |
|     `foo.?`      | Matches file names starting with`foo.`and a single character extension |
|   `/home/*/*`    |                        Matches`/home/gus/data`                         |
|    `/home/**`    |                 Matches`/home/gus`and`/home/gus/data`                  |
|------------------|------------------------------------------------------------------------|
[Pattern Language]

The following rules are used to interpret glob patterns:

- The`*`character matches zero or more[characters](https://developer.android.com/reference/java/lang/Character)of a[name](https://developer.android.com/reference/java/nio/file/Path#getName(int))component without crossing directory boundaries.

- The`**`characters matches zero or more[characters](https://developer.android.com/reference/java/lang/Character)crossing directory boundaries.

- The`?`character matches exactly one character of a name component.

- The backslash character (`\`) is used to escape characters that would otherwise be interpreted as special characters. The expression`\\`matches a single backslash and "\\{" matches a left brace for example.

- The`[ ]`characters are a*bracket expression* that match a single character of a name component out of a set of characters. For example,`[abc]`matches`"a"`,`"b"`, or`"c"`. The hyphen (`-`) may be used to specify a range so`[a-z]`specifies a range that matches from`"a"`to`"z"`(inclusive). These forms can be mixed so \[abce-g\] matches`"a"`,`"b"`,`"c"`,`"e"`,`"f"`or`"g"`. If the character after the`[`is a`!`then it is used for negation so`[!a-c]`matches any character except`"a"`,`"b"`, or`"c"`.

  Within a bracket expression the`*`,`?`and`\`characters match themselves. The (`-`) character matches itself if it is the first character within the brackets, or the first character after the`!`if negating.
- The`{ }`characters are a group of subpatterns, where the group matches if any subpattern in the group matches. The`","`character is used to separate the subpatterns. Groups cannot be nested.

- Leading period`/`dot characters in file name are treated as regular characters in match operations. For example, the`"*"`glob pattern matches file name`".login"`. The[Files.isHidden](https://developer.android.com/reference/java/nio/file/Files#isHidden(java.nio.file.Path))method may be used to test whether a file is considered hidden.

- All other characters match themselves in an implementation dependent manner. This includes characters representing any[name-separators](https://developer.android.com/reference/java/nio/file/FileSystem#getSeparator()).

- The matching of[root](https://developer.android.com/reference/java/nio/file/Path#getRoot())components is highly implementation-dependent and is not specified.

When the syntax is "`regex`" then the pattern component is a regular expression as defined by the[Pattern](https://developer.android.com/reference/java/util/regex/Pattern)class.

For both the glob and regex syntaxes, the matching details, such as whether the matching is case sensitive, are implementation-dependent and therefore not specified.

<br />

|                         Parameters                          ||
|--------------------|-----------------------------------------|
| `syntaxAndPattern` | `String`: The syntax and pattern <br /> |

|                                                                           Returns                                                                           ||
|----------------------------------------------------------------------------------|---------------------------------------------------------------------------|
| [PathMatcher](https://developer.android.com/reference/java/nio/file/PathMatcher) | A path matcher that may be used to match paths against the pattern <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException)           | If the parameter does not take the form:`syntax:pattern` |
| [PatternSyntaxException](https://developer.android.com/reference/java/util/regex/PatternSyntaxException)         | If the pattern is invalid                                |
| [UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException) | If the pattern syntax is not known to the implementation |

**See also:**

- [Files.newDirectoryStream(Path, String)](https://developer.android.com/reference/java/nio/file/Files#newDirectoryStream(java.nio.file.Path,%20java.lang.String))  

### getRootDirectories

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Iterable<Path> getRootDirectories ()
```

Returns an object to iterate over the paths of the root directories.

A file system provides access to a file store that may be composed of a number of distinct file hierarchies, each with its own top-level root directory. Unless denied by the security manager, each element in the returned iterator corresponds to the root directory of a distinct file hierarchy. The order of the elements is not defined. The file hierarchies may change during the lifetime of the Java virtual machine. For example, in some implementations, the insertion of removable media may result in the creation of a new file hierarchy with its own top-level directory.

When a security manager is installed, it is invoked to check access to the each root directory. If denied, the root directory is not returned by the iterator. In the case of the default provider, the[SecurityManager.checkRead(java.lang.String)](https://developer.android.com/reference/java/lang/SecurityManager#checkRead(java.lang.String))method is invoked to check read access to each root directory. It is system dependent if the permission checks are done when the iterator is obtained or during iteration.

<br />

|                                                                                                Returns                                                                                                ||
|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [Iterable](https://developer.android.com/reference/java/lang/Iterable)`<`[Path](https://developer.android.com/reference/java/nio/file/Path)`>` | An object to iterate over the root directories <br /> |

### getSeparator

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String getSeparator ()
```

Returns the name separator, represented as a string.

The name separator is used to separate names in a path string. An implementation may support multiple name separators in which case this method returns an implementation specific*default* name separator. This separator is used when creating path strings by invoking the[toString()](https://developer.android.com/reference/java/nio/file/Path#toString())method.

In the case of the default provider, this method returns the same separator as[File.separator](https://developer.android.com/reference/java/io/File#separator).

<br />

|                                            Returns                                            ||
|--------------------------------------------------------------------|---------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | The name separator <br /> |

### getUserPrincipalLookupService

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract UserPrincipalLookupService getUserPrincipalLookupService ()
```

Returns the`UserPrincipalLookupService`for this file system*(optional operation)*. The resulting lookup service may be used to lookup user or group names.

**Usage Example:**Suppose we want to make "joe" the owner of a file:  

```
     UserPrincipalLookupService lookupService = FileSystems.getDefault().getUserPrincipalLookupService();
     Files.setOwner(path, lookupService.lookupPrincipalByName("joe"));
 
```

<br />

<br />

|                                                                                       Returns                                                                                        ||
|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [UserPrincipalLookupService](https://developer.android.com/reference/java/nio/file/attribute/UserPrincipalLookupService) | The`UserPrincipalLookupService`for this file system <br /> |

|                                                                                  Throws                                                                                  ||
|------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
| [UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException) | If this`FileSystem`does not does have a lookup service |

### isOpen

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean isOpen ()
```

Tells whether or not this file system is open.

File systems created by the default provider are always open.

<br />

|                              Returns                              ||
|-----------|--------------------------------------------------------|
| `boolean` | `true`if, and only if, this file system is open <br /> |

### isReadOnly

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean isReadOnly ()
```

Tells whether or not this file system allows only read-only access to its file stores.

<br />

|                                       Returns                                       ||
|-----------|--------------------------------------------------------------------------|
| `boolean` | `true`if, and only if, this file system provides read-only access <br /> |

### newWatchService

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract WatchService newWatchService ()
```

Constructs a new[WatchService](https://developer.android.com/reference/java/nio/file/WatchService)*(optional operation)*.

This method constructs a new watch service that may be used to watch registered objects for changes and events.

<br />

|                                                    Returns                                                     ||
|------------------------------------------------------------------------------------|----------------------------|
| [WatchService](https://developer.android.com/reference/java/nio/file/WatchService) | a new watch service <br /> |

|                                                                                                                                         Throws                                                                                                                                          ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException) | If this`FileSystem`does not support watching file system objects for changes and events. This exception is not thrown by`FileSystems`created by the default provider. |
| [IOException](https://developer.android.com/reference/java/io/IOException)                                       | If an I/O error occurs                                                                                                                                                |

### provider

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract FileSystemProvider provider ()
```

Returns the provider that created this file system.

<br />

|                                                                        Returns                                                                         ||
|----------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [FileSystemProvider](https://developer.android.com/reference/java/nio/file/spi/FileSystemProvider) | The provider that created this file system. <br /> |

### supportedFileAttributeViews

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Set<String> supportedFileAttributeViews ()
```

Returns the set of the[names](https://developer.android.com/reference/java/nio/file/attribute/AttributeView#name())of the file attribute views supported by this`FileSystem`.

The[BasicFileAttributeView](https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView)is required to be supported and therefore the set contains at least one element, "basic".

The[supportsFileAttributeView(String)](https://developer.android.com/reference/java/nio/file/FileStore#supportsFileAttributeView(java.lang.String))method may be used to test if an underlying[FileStore](https://developer.android.com/reference/java/nio/file/FileStore)supports the file attributes identified by a file attribute view.

<br />

|                                                                                                       Returns                                                                                                       ||
|--------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| [Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | An unmodifiable set of the names of the supported file attribute views <br /> |