Java library for accessing extended file attributes (comments, tags, etc), defined by the freedesktop project.
HowTo use the org.freedesktop.Attributes class for manipulating/read user attributes:
//Initialize with java.nio.file.Path
Attributes userAttributes = Attributes.loadUserAttributes(path);
//Read Tags an display it
Tags tags = userAttributes.getAttribute(UserAttributes.Types.TAGS.getAttributeID(), Tags.class);
tags.stream().forEach((tag) -> {
System.out.println(tag);
});
//Set a comment and some other attribute into the file
AttributeID myID = AttributeID.newInstance().name("someTest").namespace("jxattr").build();
GenericAttribute myAttribute = GenericAttribute.newInstance(myID).value("Hello World").build();
userAttributes.setAttributes(UserAttributes.Types.COMMENT.createInstance("Some comment"), myAttribute);
//Remove the other attribute
userAttributes.removeAttributes(myID);