Class AttributeService
java.lang.Object
io.roastedroot.zerofs.AttributeService
Service providing all attribute related operations for a file store. One piece of the file store
implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classSimple implementation ofFileAttribute. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate final List<FileAttribute<?>> private final Map<Class<?>, AttributeProvider> private final Map<String, AttributeProvider> private final Map<Class<?>, AttributeProvider> -
Constructor Summary
ConstructorsConstructorDescriptionAttributeService(Configuration configuration) Creates a new attribute service using the given configuration.AttributeService(Iterable<? extends AttributeProvider> providers, Map<String, ?> userProvidedDefaults) Creates a new attribute service using the given providers and user provided default attribute values. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddMissingProviders(Map<String, AttributeProvider> providers) private static voidaddStandardProvider(Map<String, AttributeProvider> result, String view) voidcopyAttributes(File file, File copy, AttributeCopyOption copyOption) Copies the attributes of the given file to the given copy file.private Map<String, FileAttributeView> createInheritedViews(FileLookup lookup, AttributeProvider provider) private voidcreateInheritedViews(FileLookup lookup, AttributeProvider provider, Map<String, FileAttributeView> inheritedViews) getAttribute(File file, String attribute) Gets the value of the given attribute for the given file.getAttribute(File file, String view, String attribute) Gets the value of the given attribute for the given view and file.private ObjectgetAttributeInternal(File file, String view, String attribute) getAttributeNames(String attributes) private FileAttributeViewgetFileAttributeView(FileLookup lookup, Class<? extends FileAttributeView> viewType, Map<String, FileAttributeView> inheritedViews) <V extends FileAttributeView>
VgetFileAttributeView(FileLookup lookup, Class<V> type) Returns an attribute view of the given type for the given file lookup callback, ornullif the view type is not supported.private static Iterable<AttributeProvider> getProviders(Configuration configuration) private static StringgetSingleAttribute(String attribute) private static StringgetViewName(String attribute) private static void<A extends BasicFileAttributes>
AreadAttributes(File file, Class<A> type) Returns attributes of the given file as an object of the given type.readAttributes(File file, String attributes) voidsetAttribute(File file, String attribute, Object value, boolean create) Sets the value of the given attribute to the given value for the given file.private voidsetAttributeInternal(File file, String view, String attribute, Object value, boolean create) voidsetInitialAttributes(File file, FileAttribute<?>... attrs) Sets all initial attributes for the given file, including the given attributes if possible.ImplementsFileSystem.supportedFileAttributeViews().booleansupportsFileAttributeView(Class<? extends FileAttributeView> type) ImplementsFileStore.supportsFileAttributeView(Class).
-
Field Details
-
ALL_ATTRIBUTES
- See Also:
-
providersByName
-
providersByViewType
-
providersByAttributesType
-
defaultValues
-
ATTRIBUTE_SPLITTER
- See Also:
-
-
Constructor Details
-
AttributeService
Creates a new attribute service using the given configuration. -
AttributeService
public AttributeService(Iterable<? extends AttributeProvider> providers, Map<String, ?> userProvidedDefaults) Creates a new attribute service using the given providers and user provided default attribute values.
-
-
Method Details
-
getProviders
-
addMissingProviders
-
addStandardProvider
-
supportedFileAttributeViews
ImplementsFileSystem.supportedFileAttributeViews(). -
supportsFileAttributeView
ImplementsFileStore.supportsFileAttributeView(Class). -
setInitialAttributes
Sets all initial attributes for the given file, including the given attributes if possible. -
copyAttributes
Copies the attributes of the given file to the given copy file. -
getAttribute
-
getAttribute
-
getAttributeInternal
-
setAttribute
-
setAttributeInternal
-
getFileAttributeView
Returns an attribute view of the given type for the given file lookup callback, ornullif the view type is not supported. -
getFileAttributeView
private FileAttributeView getFileAttributeView(FileLookup lookup, Class<? extends FileAttributeView> viewType, Map<String, FileAttributeView> inheritedViews) -
createInheritedViews
private Map<String, FileAttributeView> createInheritedViews(FileLookup lookup, AttributeProvider provider) -
createInheritedViews
private void createInheritedViews(FileLookup lookup, AttributeProvider provider, Map<String, FileAttributeView> inheritedViews) -
readAttributes
-
readAttributes
Returns attributes of the given file as an object of the given type.- Throws:
UnsupportedOperationException- if the given attributes type is not supported
-
readAll
-
getViewName
-
getAttributeNames
-
getSingleAttribute
-