Package com.google.common.jimfs
Class PosixAttributeProvider
java.lang.Object
com.google.common.jimfs.AttributeProvider
com.google.common.jimfs.PosixAttributeProvider
Attribute provider that provides the
PosixFileAttributeView
("posix") and allows reading
of PosixFileAttributes
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
Implementation ofPosixFileAttributes
.private static class
Implementation ofPosixFileAttributeView
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.common.collect.ImmutableSet
<String> private static final GroupPrincipal
private static final com.google.common.collect.ImmutableSet
<PosixFilePermission> private static final com.google.common.collect.ImmutableSet
<String> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the type of file attributes object this provider supports, or null if it doesn't support reading its attributes as an object.com.google.common.collect.ImmutableMap
<String, ?> defaultValues
(Map<String, ?> userProvidedDefaults) Returns a map containing the default attribute values for this provider.com.google.common.collect.ImmutableSet
<String> Returns the set of attributes that are always available from this provider.@Nullable Object
Returns the value of the given attribute in the given file or null if the attribute is not supported by this provider.com.google.common.collect.ImmutableSet
<String> inherits()
Returns the names of other providers that this provider inherits attributes from.name()
Returns the view name that's used to get attributes from this provider.readAttributes
(File file) Reads this provider's attributes from the given file as an attributes object.void
Sets the value of the given attribute in the given file object.private static com.google.common.collect.ImmutableSet
<PosixFilePermission> toPermissions
(Set<?> set) view
(FileLookup lookup, com.google.common.collect.ImmutableMap<String, FileAttributeView> inheritedViews) Returns a view of the file located by the given lookup callback.viewType()
Returns the type of the view interface that this provider supports.Methods inherited from class com.google.common.jimfs.AttributeProvider
attributes, checkNotCreate, checkType, invalidType, supports, unsettable
-
Field Details
-
ATTRIBUTES
-
INHERITED_VIEWS
-
DEFAULT_GROUP
-
DEFAULT_PERMISSIONS
private static final com.google.common.collect.ImmutableSet<PosixFilePermission> DEFAULT_PERMISSIONS
-
-
Constructor Details
-
PosixAttributeProvider
PosixAttributeProvider()
-
-
Method Details
-
name
Description copied from class:AttributeProvider
Returns the view name that's used to get attributes from this provider.- Specified by:
name
in classAttributeProvider
-
inherits
Description copied from class:AttributeProvider
Returns the names of other providers that this provider inherits attributes from.- Overrides:
inherits
in classAttributeProvider
-
fixedAttributes
Description copied from class:AttributeProvider
Returns the set of attributes that are always available from this provider.- Specified by:
fixedAttributes
in classAttributeProvider
-
defaultValues
public com.google.common.collect.ImmutableMap<String,?> defaultValues(Map<String, ?> userProvidedDefaults) Description copied from class:AttributeProvider
Returns a map containing the default attribute values for this provider. The keys of the map are attribute identifier strings (in "view:attribute" form) and the value for each is the default value that should be set for that attribute when creating a new file.The given map should be in the same format and contains user-provided default values. If the user provided any default values for attributes handled by this provider, those values should be checked to ensure they are of the correct type. Additionally, if any changes to a user-provided attribute are necessary (for example, creating an immutable defensive copy), that should be done. The resulting values should be included in the result map along with default values for any attributes the user did not provide a value for.
- Overrides:
defaultValues
in classAttributeProvider
-
get
Description copied from class:AttributeProvider
Returns the value of the given attribute in the given file or null if the attribute is not supported by this provider.- Specified by:
get
in classAttributeProvider
-
set
Description copied from class:AttributeProvider
Sets the value of the given attribute in the given file object. Thecreate
parameter indicates whether or not the value is being set upon creation of a new file via a user-providedFileAttribute
.- Specified by:
set
in classAttributeProvider
-
toPermissions
private static com.google.common.collect.ImmutableSet<PosixFilePermission> toPermissions(Set<?> set) -
viewType
Description copied from class:AttributeProvider
Returns the type of the view interface that this provider supports.- Specified by:
viewType
in classAttributeProvider
-
view
public PosixFileAttributeView view(FileLookup lookup, com.google.common.collect.ImmutableMap<String, FileAttributeView> inheritedViews) Description copied from class:AttributeProvider
Returns a view of the file located by the given lookup callback. The given map contains the views inherited by this view.- Specified by:
view
in classAttributeProvider
-
attributesType
Description copied from class:AttributeProvider
Returns the type of file attributes object this provider supports, or null if it doesn't support reading its attributes as an object.- Overrides:
attributesType
in classAttributeProvider
-
readAttributes
Description copied from class:AttributeProvider
Reads this provider's attributes from the given file as an attributes object.- Overrides:
readAttributes
in classAttributeProvider
-