Skip to content

konradrenner/jxattr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 

Repository files navigation

jxattr

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);

Travis: Build Status

Coverity Scan: Coverity Scan Build Status

About

java library for accessing extended file attributes (comments, tags, etc), defined by the freedesktop project

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages