java - How to read file: Properties > Details > Content > Pages e.g. for a word document -


when right-click on file in windows can select "properties" in menu. in upcoming dialog box see tab: "details". there can find lot of properties (name, type, owner, ...)! question is:

how can read file properties?

i've tried years ago , not possible me. think java 1.7 might possible. have tried userdefinedattributeview it's not working.

i have tried following: see in details tab section "file" , property "name". exception if execute below code:

exception in thread "main" java.nio.file.nosuchfileexception: d:\test.txt:file.name

and text.txt exists ;)

    path path = new file("d:\\test.txt").topath();             userdefinedfileattributeview view = files.getfileattributeview(path,   userdefinedfileattributeview.class);     string name = "file.name";     bytebuffer buf = bytebuffer.allocate(view.size(name));             view.read(name, buf);     buf.flip();     string value = charset.defaultcharset().decode(buf).tostring(); 

many support!

i had similar problem , solved calling new attribute "user." , getting same string "user.". i'm not sure "file." works, anyway check user's defined attributes list command "view.list().tostring()".

hoping have (..even if quite late...)


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -