Java examples for File Path IO:File Attribute
List User-Defined Attribute Names and Value Sizes
import java.io.IOException; 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 {/*www . j av a 2 s . c om*/ for (String name : udfav.list()) { System.out.println(udfav.size(name) + " " + name); } } catch (IOException e) { System.err.println(e); } } }