Package java.nio.file.attribute

Examples of java.nio.file.attribute.BasicFileAttributes.lastModifiedTime()


                    owner.addString("", counter);
                    group.addString("", counter);
                }

                // show year instead of time when file wasn't changed in actual year
                Date lastModifiedTime = new Date(attr.lastModifiedTime().toMillis());

                Calendar lastModifiedCalendar = Calendar.getInstance();
                lastModifiedCalendar.setTime(lastModifiedTime);

                Calendar nowCalendar = Calendar.getInstance();
View Full Code Here


    System.out.println("File infos");
    System.out.printf(">>> Creation Time: %s\n", basicAttributes.creationTime());
    System.out.printf(">>> Directory? %s\n", basicAttributes.isDirectory());
    System.out.printf(">>> File? %s\n", basicAttributes.isRegularFile());
    System.out.printf(">>> Last accessed on: %s\n", basicAttributes.lastAccessTime());
    System.out.printf(">>> Last modified on: %s\n", basicAttributes.lastModifiedTime());
    System.out.printf(">>> File size (bytes): %s\n", basicAttributes.size());
    System.out.printf(">>> File key : %s\n", basicAttributes.fileKey());
    File tempDir = new File(System.getProperty("java.io.tmpdir"));
    Path tempDirPathRef = Paths.get(tempDir.toURI());
    Path p = null;
View Full Code Here

                    owner.addString("", counter);
                if(Config.isOSPOSIXCompatible())
                    group.addString(((PosixFileAttributes) attr).group().getName(), counter);
                else
                    owner.addString("", counter);
                modified.addString(DATE_FORMAT.format(new Date(attr.lastModifiedTime().toMillis())), counter);

                counter++;
            }
        }
        catch (IOException e) {
View Full Code Here

                    owner.addString("", counter);
                    group.addString("", counter);
                }

                // show year instead of time when file wasn't changed in actual year
                Date lastModifiedTime = new Date(attr.lastModifiedTime().toMillis());

                Calendar lastModifiedCalendar = Calendar.getInstance();
                lastModifiedCalendar.setTime(lastModifiedTime);

                Calendar nowCalendar = Calendar.getInstance();
View Full Code Here

                    owner.addString("", counter);
                if(Config.isOSPOSIXCompatible())
                    group.addString(((PosixFileAttributes) attr).group().getName(), counter);
                else
                    owner.addString("", counter);
                modified.addString(DATE_FORMAT.format(new Date(attr.lastModifiedTime().toMillis())), counter);

                counter++;
            }
        }
        catch (IOException e) {
View Full Code Here

                    owner.addString("", counter);
                if(Config.isOSPOSIXCompatible())
                    group.addString(((PosixFileAttributes) attr).group().getName(), counter);
                else
                    owner.addString("", counter);
                modified.addString(DATE_FORMAT.format(new Date(attr.lastModifiedTime().toMillis())), counter);

                counter++;
            }
        }
        catch (IOException e) {
View Full Code Here

      }

      BasicFileAttributes basic_attr = Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
      final Long filesize = basic_attr.size();
      final FileTime creationTime = basic_attr.creationTime();
      final FileTime modifyTime = basic_attr.lastModifiedTime();
      final FileTime accessTime = basic_attr.lastAccessTime();

      if (basic_attr.isDirectory()) {
        type = ItemType.FOLDER;
      } else if (basic_attr.isRegularFile()) {
View Full Code Here

          readAttributes.isDirectory(),
          fs.supportsExecute() ? path.canExecute() : false,
          readAttributes.isSymbolicLink(),
          readAttributes.isRegularFile(), //
          readAttributes.creationTime().toMillis(), //
          readAttributes.lastModifiedTime().toMillis(),
          readAttributes.isSymbolicLink() ? Constants
              .encode(FileUtils.readSymLink(path)).length
              : readAttributes.size());
      return attributes;
    } catch (NoSuchFileException e) {
View Full Code Here

    public static long getLastModified( File file ){
        try
        {
            BasicFileAttributes basicFileAttributes =
                Files.readAttributes( file.toPath(), BasicFileAttributes.class );
            return basicFileAttributes.lastModifiedTime().toMillis();
        }
        catch ( IOException e )
        {
            throw new RuntimeException( e );
        }
View Full Code Here

    FileTimeTester(Path path) throws IOException {
      this.path = path;

      BasicFileAttributes attrs = attrs();
      accessTime = attrs.lastAccessTime();
      modifiedTime = attrs.lastModifiedTime();
    }

    private BasicFileAttributes attrs() throws IOException {
      return Files.readAttributes(path, BasicFileAttributes.class);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.