public static final class Configuration.Builder extends Object
Configuration
objects.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BLOCK_SIZE
8 KB.
|
static long |
DEFAULT_MAX_CACHE_SIZE
Equal to the configured max size.
|
static long |
DEFAULT_MAX_SIZE
4 GB.
|
Modifier and Type | Method and Description |
---|---|
Configuration.Builder |
addAttributeProvider(AttributeProvider provider)
Adds an attribute provider for a custom view for the file system to support.
|
Configuration |
build()
Creates a new immutable configuration object from this builder.
|
Configuration.Builder |
setAttributeViews(String first,
String... more)
Sets the attribute views the file system should support.
|
Configuration.Builder |
setBlockSize(int blockSize)
Sets the block size (in bytes) for the file system to use.
|
Configuration.Builder |
setDefaultAttributeValue(String attribute,
Object value)
Sets the default value to use for the given file attribute when creating new files.
|
Configuration.Builder |
setMaxCacheSize(long maxCacheSize)
Sets the maximum amount of unused space (in bytes) in the file system's in-memory file
storage that should be cached for reuse.
|
Configuration.Builder |
setMaxSize(long maxSize)
Sets the maximum size (in bytes) for the file system's in-memory file storage.
|
Configuration.Builder |
setNameCanonicalNormalization(PathNormalization first,
PathNormalization... more)
Returns the normalizations that will be applied to the canonical form of filenames in the
file system.
|
Configuration.Builder |
setNameDisplayNormalization(PathNormalization first,
PathNormalization... more)
Sets the normalizations that will be applied to the display form of filenames.
|
Configuration.Builder |
setPathEqualityUsesCanonicalForm(boolean useCanonicalForm)
Sets whether
Path objects in the file system use the canonical form (true) or the
display form (false) of filenames for determining equality of two paths. |
Configuration.Builder |
setRoots(String first,
String... more)
Sets the roots for the file system.
|
Configuration.Builder |
setSupportedFeatures(Feature... features)
Sets the given features to be supported by the file system.
|
Configuration.Builder |
setWatchServiceConfiguration(WatchServiceConfiguration config)
Sets the configuration that
WatchService instances created by the file system
should use. |
Configuration.Builder |
setWorkingDirectory(String workingDirectory)
Sets the path to the working directory for the file system.
|
public static final int DEFAULT_BLOCK_SIZE
public static final long DEFAULT_MAX_SIZE
public static final long DEFAULT_MAX_CACHE_SIZE
public Configuration.Builder setNameDisplayNormalization(PathNormalization first, PathNormalization... more)
toString()
of Path
objects.public Configuration.Builder setNameCanonicalNormalization(PathNormalization first, PathNormalization... more)
public Configuration.Builder setPathEqualityUsesCanonicalForm(boolean useCanonicalForm)
Path
objects in the file system use the canonical form (true) or the
display form (false) of filenames for determining equality of two paths.
The default is false.
public Configuration.Builder setBlockSize(int blockSize)
The default is 8192 bytes (8 KB).
public Configuration.Builder setMaxSize(long maxSize)
Note: The in-memory file storage will not be eagerly initialized to this size, so it won't use more memory than is needed for the files you create. Also note that in addition to this limit, you will of course be limited by the amount of heap space available to the JVM and the amount of heap used by other objects, both in the file system and elsewhere.
The default is 4 GB.
public Configuration.Builder setMaxCacheSize(long maxCacheSize)
Like the maximum size, the actual value will be the closest multiple of the block size that is less than or equal to the given size.
public Configuration.Builder setAttributeViews(String first, String... more)
Name | View Interface | Attributes Interface |
"basic" |
BasicFileAttributeView |
BasicFileAttributes |
"owner" |
FileOwnerAttributeView |
-- |
"posix" |
PosixFileAttributeView |
PosixFileAttributes |
"unix" |
-- | -- |
"dos" |
DosFileAttributeView |
DosFileAttributes |
"acl" |
AclFileAttributeView |
-- |
"user" |
UserDefinedFileAttributeView |
-- |
If any other views should be supported, attribute providers for those views must be added.
public Configuration.Builder addAttributeProvider(AttributeProvider provider)
public Configuration.Builder setDefaultAttributeValue(String attribute, Object value)
For the included attribute views, default values can be set for the following attributes:
Attribute | Legal Types |
---|---|
"owner:owner" |
String (user name) |
"posix:group" |
String (group name) |
"posix:permissions" |
String (format "rwxrw-r--"), Set<PosixFilePermission> |
"dos:readonly" |
Boolean |
"dos:hidden" |
Boolean |
"dos:archive" |
Boolean |
"dos:system" |
Boolean |
"acl:acl" |
List<AclEntry> |
public Configuration.Builder setRoots(String first, String... more)
InvalidPathException
- if any of the given roots is not a valid path for this
builder's path typeIllegalArgumentException
- if any of the given roots is a valid path for this
builder's path type but is not a root path with no name elementspublic Configuration.Builder setWorkingDirectory(String workingDirectory)
InvalidPathException
- if the given path is not valid for this builder's path typeIllegalArgumentException
- if the given path is valid for this builder's path type but
is not an absolute pathpublic Configuration.Builder setSupportedFeatures(Feature... features)
public Configuration.Builder setWatchServiceConfiguration(WatchServiceConfiguration config)
WatchService
instances created by the file system
should use. The default configuration polls watched directories for changes every 5 seconds.public Configuration build()
Copyright © 2013–2018 Google Inc.. All rights reserved.