Path file = ...;
BasicFileAttributes attr = Files.readAttributes(file, BasicFileAttributes.class);
System.out.println("creationTime: " + attr.creationTime());
System.out.println("lastAccessTime: " + attr.lastAccessTime());
System.out.println("lastModifiedTime: " + attr.lastModifiedTime());
BTW, this:
basicFileAttributes = createObject("java", "java.nio.file.attribute.BasicFileAttributes");
writeDump(basicFileAttributes.class);
...throws this (on the dump line):
No matching Constructor for java.nio.file.attribute.BasicFileAttributes() found
Thanks,
Jamie
--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/c7b902f8-fabe-4ae1-9de6-27ea286cf011%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
CFML and Java do not play together well with what you are trying to do.
dir = expandPath("./");
paths = createObject("java", "java.nio.file.Paths");
p = paths.get(dir, []);
files = createObject("java", "java.nio.file.Files");
linkOption = createObject("java", "java.nio.file.LinkOption");
linkOptions = linkOption.values();
basicFileAttributeView = createObject("java", "java.nio.file.attribute.BasicFileAttributeView");
basicFileAttributeViewClass=basicFileAttributeView.getClass();
view = files.getFileAttributeView(p, basicFileAttributeViewClass, linkOptions).readAttributes();
writeOutput("#view.creationTime()# is the same as #view.lastModifiedTime()#");
On Aug 21, 2015, at 1:11 AM, Adam Cameron <camero...@gmail.com> wrote:
I hasten to add my Java is fairly pedestrian, and this is just the result of taking the code from StackOverflow and doing all the extra stuff CFML needs to do the same thing. It might not be the best way to go about things.On ColdFusion this outputs:2015-08-21T07:52:50.951374Z is the same as 2015-08-21T07:53:03.644183Z(that's obviously nonsense, but it's what the code is supposed to do)On Lucee it errors cos one cannot call getClass() as indicated earlier.
:-/
--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/58cb0334-c0dc-47d2-9bbf-99214ac54733%40googlegroups.com.
So if all we need is read-only access to the attributes, we could condense your code into: