Package com.google.common.jimfs
Class UserDefinedAttributeProvider
- java.lang.Object
-
- com.google.common.jimfs.AttributeProvider
-
- com.google.common.jimfs.UserDefinedAttributeProvider
-
final class UserDefinedAttributeProvider extends AttributeProvider
Attribute provider that provides theUserDefinedFileAttributeView("user"). Unlike most other attribute providers, this one has no pre-defined set of attributes. Rather, it allows arbitrary user defined attributes to be set (asByteBufferorbyte[]) and read (asbyte[]).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classUserDefinedAttributeProvider.ViewImplementation ofUserDefinedFileAttributeView.
-
Constructor Summary
Constructors Constructor Description UserDefinedAttributeProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableSet<java.lang.String>attributes(File file)Returns the set of attributes supported by this view that are present in the given file.com.google.common.collect.ImmutableSet<java.lang.String>fixedAttributes()Returns the set of attributes that are always available from this provider.@Nullable java.lang.Objectget(File file, java.lang.String attribute)Returns the value of the given attribute in the given file or null if the attribute is not supported by this provider.java.lang.Stringname()Returns the view name that's used to get attributes from this provider.voidset(File file, java.lang.String view, java.lang.String attribute, java.lang.Object value, boolean create)Sets the value of the given attribute in the given file object.booleansupports(java.lang.String attribute)Returns whether or not this provider supports the given attribute directly.private static com.google.common.collect.ImmutableSet<java.lang.String>userDefinedAttributes(File file)java.nio.file.attribute.UserDefinedFileAttributeViewview(FileLookup lookup, com.google.common.collect.ImmutableMap<java.lang.String,java.nio.file.attribute.FileAttributeView> inheritedViews)Returns a view of the file located by the given lookup callback.java.lang.Class<java.nio.file.attribute.UserDefinedFileAttributeView>viewType()Returns the type of the view interface that this provider supports.-
Methods inherited from class com.google.common.jimfs.AttributeProvider
attributesType, checkNotCreate, checkType, defaultValues, inherits, invalidType, readAttributes, unsettable
-
-
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from class:AttributeProviderReturns the view name that's used to get attributes from this provider.- Specified by:
namein classAttributeProvider
-
fixedAttributes
public com.google.common.collect.ImmutableSet<java.lang.String> fixedAttributes()
Description copied from class:AttributeProviderReturns the set of attributes that are always available from this provider.- Specified by:
fixedAttributesin classAttributeProvider
-
supports
public boolean supports(java.lang.String attribute)
Description copied from class:AttributeProviderReturns whether or not this provider supports the given attribute directly.- Overrides:
supportsin classAttributeProvider
-
attributes
public com.google.common.collect.ImmutableSet<java.lang.String> attributes(File file)
Description copied from class:AttributeProviderReturns the set of attributes supported by this view that are present in the given file. For most providers, this will be a fixed set of attributes.- Overrides:
attributesin classAttributeProvider
-
userDefinedAttributes
private static com.google.common.collect.ImmutableSet<java.lang.String> userDefinedAttributes(File file)
-
get
public @Nullable java.lang.Object get(File file, java.lang.String attribute)
Description copied from class:AttributeProviderReturns the value of the given attribute in the given file or null if the attribute is not supported by this provider.- Specified by:
getin classAttributeProvider
-
set
public void set(File file, java.lang.String view, java.lang.String attribute, java.lang.Object value, boolean create)
Description copied from class:AttributeProviderSets the value of the given attribute in the given file object. Thecreateparameter indicates whether or not the value is being set upon creation of a new file via a user-providedFileAttribute.- Specified by:
setin classAttributeProvider
-
viewType
public java.lang.Class<java.nio.file.attribute.UserDefinedFileAttributeView> viewType()
Description copied from class:AttributeProviderReturns the type of the view interface that this provider supports.- Specified by:
viewTypein classAttributeProvider
-
view
public java.nio.file.attribute.UserDefinedFileAttributeView view(FileLookup lookup, com.google.common.collect.ImmutableMap<java.lang.String,java.nio.file.attribute.FileAttributeView> inheritedViews)
Description copied from class:AttributeProviderReturns a view of the file located by the given lookup callback. The given map contains the views inherited by this view.- Specified by:
viewin classAttributeProvider
-
-