使用FileOwnerAttributeView维护文件所有权属性
import java.io.IOException; /** from nowjava.com**/ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.FileOwnerAttributeView; import java.nio.file.attribute.UserPrincipal; public class Main { public static void main(String[] args) { Path path = Paths.get("C:/home/docs/users.txt"); try { FileOwnerAttributeView view = Files.getFileAttributeView(path,//时 代 J a v a 公 众 号 - N o w J a v a . c o m FileOwnerAttributeView.class); UserPrincipal userPrincipa