FileSystem Class

Definition

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

[Android.Runtime.Register("java/nio/file/FileSystem", ApiSince=26, DoNotGenerateAcw=true)]
public abstract class FileSystem : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ICloseable
[<Android.Runtime.Register("java/nio/file/FileSystem", ApiSince=26, DoNotGenerateAcw=true)>]
type FileSystem = class
    inherit Object
    interface ICloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
FileSystem
Attributes
Implements

Remarks

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 FileSystems.getDefault method, provides access to the file system that is accessible to the Java virtual machine. The 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:

<ul> <li>

The #getPath getPath method converts a system dependent <em>path string</em>, returning a Path object that may be used to locate and access a file.

</li> <li>

The #getPathMatcher getPathMatcher method is used to create a PathMatcher that performs match operations on paths.

</li> <li>

The #getFileStores getFileStores method returns an iterator over the underlying FileStore file-stores.

</li> <li>

The #getUserPrincipalLookupService getUserPrincipalLookupService method returns the UserPrincipalLookupService to lookup users or groups by name.

</li> <li>

The #newWatchService newWatchService method creates a WatchService that may be used to watch objects for changes and events.

</li> </ul>

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 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 FileStore file-stores that provide the storage for the files. Theses file stores can also vary in the features they support, and the file attributes or <em>meta-data</em> that they associate with files.

A file system is open upon creation and can be closed by invoking its #close() close method. Once closed, any further attempt to access objects in the file system cause ClosedFileSystemException to be thrown. File systems created by the default FileSystemProvider provider 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() isReadOnly method. Attempts to write to file stores by means of an object associated with a read-only file system throws ReadOnlyFileSystemException.

File systems are safe for use by multiple concurrent threads. The #close 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 closeable objects associated with the file system to be closed.

Added in 1.7.

Java documentation for java.nio.file.FileSystem.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

FileSystem()

Initializes a new instance of this class.

FileSystem(IntPtr, JniHandleOwnership)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
FileStores
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsOpen
IsReadOnly
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
RootDirectories
Separator
ThresholdClass
ThresholdType
UserPrincipalLookupService

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Closes this file system.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetPath(String, String[])

Converts a path string, or a sequence of strings that when joined form a path string, to a Path.

GetPathMatcher(String)

Returns a PathMatcher that performs match operations on the String representation of Path objects by interpreting a given pattern.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
NewWatchService()

Constructs a new WatchService(optional operation).

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Provider()

Returns the provider that created this file system.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SupportedFileAttributeViews()

Returns the set of the FileAttributeView#name names of the file attribute views supported by this FileSystem.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to