定义用户属性
import java.io.IOException; import java.nio.charset.Charset; /* 来自 *n o w j a v a . c o m*/ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.UserDefinedFileAttributeView; public class Main { public static void main(String[] args) { Path path = Paths.get("C:/folder1/folder2/folder4", "test.txt"); UserDefinedFileAttributeView udfav = Files.getFileAttributeView(path, UserDefinedFileAttributeView.class); try { int written = udfav.write("file.description", Charset.defaultCharset() .encode(