Class Configuration
- java.lang.Object
-
- com.google.common.jimfs.Configuration
-
public final class Configuration extends java.lang.Object
Immutable configuration for an in-memory file system. AConfiguration
is passed to a method inJimfs
such asJimfs.newFileSystem(Configuration)
to create a newFileSystem
instance.- Author:
- Colin Decker
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Configuration.Builder
Mutable builder forConfiguration
objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Configuration.Builder
builder(PathType pathType)
Creates a new mutableConfiguration
builder using the given path type.static Configuration
forCurrentPlatform()
Returns a default configuration appropriate to the current operating system.static Configuration
osX()
Returns the default configuration for a Mac OS X-like file system.Configuration.Builder
toBuilder()
Returns a new mutable builder that initially contains the same settings as this configuration.static Configuration
unix()
Returns the default configuration for a UNIX-like file system.static Configuration
windows()
Returns the default configuration for a Windows-like file system.
-
-
-
Method Detail
-
unix
public static Configuration unix()
Returns the default configuration for a UNIX-like file system. A file system created with this configuration:
- uses
/
as the path name separator (seePathType.unix()
for more information on the path format) - has root
/
and working directory/work
- performs case-sensitive file lookup
- supports only the basic file attribute view, to avoid overhead for unneeded attributes
- supports hard links, symbolic links,
SecureDirectoryStream
andFileChannel
To create a modified version of this configuration, such as to include the full set of UNIX file attribute views, create a builder.
Example:
Configuration config = Configuration.unix().toBuilder() .setAttributeViews("basic", "owner", "posix", "unix") .setWorkingDirectory("/home/user") .build();
- uses
-
osX
public static Configuration osX()
Returns the default configuration for a Mac OS X-like file system.
The primary differences between this configuration and the default
unix()
configuration are that this configuration does Unicode normalization on the display and canonical forms of filenames and does case insensitive file lookup.A file system created with this configuration:
- uses
/
as the path name separator (seePathType.unix()
for more information on the path format) - has root
/
and working directory/work
- does Unicode normalization on paths, both for lookup and for
Path
objects - does case-insensitive (for ASCII characters only) lookup
- supports only the basic file attribute view, to avoid overhead for unneeded attributes
- supports hard links, symbolic links and
FileChannel
To create a modified version of this configuration, such as to include the full set of UNIX file attribute views or to use full Unicode case insensitivity, create a builder.
Example:
Configuration config = Configuration.osX().toBuilder() .setAttributeViews("basic", "owner", "posix", "unix") .setNameCanonicalNormalization(NFD, CASE_FOLD_UNICODE) .setWorkingDirectory("/Users/user") .build();
- uses
-
windows
public static Configuration windows()
Returns the default configuration for a Windows-like file system. A file system created with this configuration:
- uses
\
as the path name separator and recognizes/
as a separator when parsing paths (seePathType.windows()
for more information on path format) - has root
C:\
and working directoryC:\work
- performs case-insensitive (for ASCII characters only) file lookup
- creates
Path
objects that use case-insensitive (for ASCII characters only) equality - supports only the basic file attribute view, to avoid overhead for unneeded attributes
- supports hard links, symbolic links and
FileChannel
To create a modified version of this configuration, such as to include the full set of Windows file attribute views or to use full Unicode case insensitivity, create a builder.
Example:
Configuration config = Configuration.windows().toBuilder() .setAttributeViews("basic", "owner", "dos", "acl", "user") .setNameCanonicalNormalization(CASE_FOLD_UNICODE) .setWorkingDirectory("C:\\Users\\user") // or "C:/Users/user" .build();
- uses
-
forCurrentPlatform
public static Configuration forCurrentPlatform()
Returns a default configuration appropriate to the current operating system.More specifically, if the operating system is Windows,
windows()
is returned; if the operating system is Mac OS X,osX()
is returned; otherwise,unix()
is returned.This is the configuration used by the
Jimfs.newFileSystem
methods that do not take aConfiguration
parameter.- Since:
- 1.1
-
builder
public static Configuration.Builder builder(PathType pathType)
Creates a new mutableConfiguration
builder using the given path type.
-
toBuilder
public Configuration.Builder toBuilder()
Returns a new mutable builder that initially contains the same settings as this configuration.
-
-