获取用户定义属性的值
import java.io.IOException; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.file.Files; /**来自 NowJava.com - 时代Java**/ 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 {/**from 时代Java公众号 - N o w J a v a . c o m**/ int size = udfav.size("file.description"); ByteBuffer bb = ByteBuffer.allocateDirect(size); udfav.read(