Package java.nio.file.attribute

Examples of java.nio.file.attribute.FileTime.toMillis()


      return;
    }
    FileTime lastModifiedTime = Files.getLastModifiedTime(file);
    writeStringToFile(file, contents);
    // Make sure last modified time is different from before
    Files.setLastModifiedTime(file, FileTime.fromMillis(lastModifiedTime.toMillis() - 1_000));
  }
 
  public void updateFileContents(Path filePath, String contents) {
    updateFileContents(filePath, contents, true);
  }
View Full Code Here


      lastModifiedTime = Files.getLastModifiedTime(filePath);
    } catch (IOException e) {
      return true;
    }
   
    if(valueTimeStamp == null || valueTimeStamp.toMillis() < lastModifiedTime.toMillis()) {
      return true;
    }
    return false;
  }
 
View Full Code Here

    public long lastModified()
    {
        try
        {
            FileTime ft = Files.getLastModifiedTime(path,NO_FOLLOW_LINKS);
            return ft.toMillis();
        }
        catch (IOException e)
        {
            LOG.ignore(e);
            return 0;
View Full Code Here

    @JRubyMethod(name = "birthtime")
    public IRubyObject birthtime(ThreadContext context) {
        checkClosed(context);

        FileTime btime = getBirthtimeWithNIO(getPath());
        if (btime != null) return context.runtime.newTime(btime.toMillis()); // btime comes in nanos
        return ctime(context);
    }

    public static final FileTime getBirthtimeWithNIO(String pathString) {
        // FIXME: birthtime is in stat, so we should use that if platform supports it (#2152)
View Full Code Here

    }

    @JRubyMethod(name = "birthtime")
    public IRubyObject birthtime() {
        FileTime btime = RubyFile.getBirthtimeWithNIO(file.absolutePath());
        if (btime != null) return getRuntime().newTime(btime.toMillis());
        return ctime();
    }

    @JRubyMethod(name = "dev")
    public IRubyObject dev() {
View Full Code Here

            if (descriptor.version.hasRepairedAt())
            {
                if (setIsRepaired)
                {
                    FileTime f = Files.getLastModifiedTime(new File(descriptor.filenameFor(Component.DATA)).toPath());
                    descriptor.getMetadataSerializer().mutateRepairedAt(descriptor, f.toMillis());
                }
                else
                {
                    descriptor.getMetadataSerializer().mutateRepairedAt(descriptor, ActiveRepairService.UNREPAIRED_SSTABLE);
                }
View Full Code Here

        }

        private Object makeDate(Context cx, Object o)
        {
            FileTime ft = (FileTime)o;
            return cx.newObject(this, "Date", new Object[] { ft.toMillis() });
        }
    }

    public static class FileHandle
    {
View Full Code Here

        String fname = args[2];
        Descriptor descriptor = Descriptor.fromFilename(fname);
        if (setIsRepaired)
        {
            FileTime f = Files.getLastModifiedTime(new File(descriptor.filenameFor(Component.DATA)).toPath());
            descriptor.getMetadataSerializer().mutateRepairedAt(descriptor, f.toMillis());
        }
        else
        {
            descriptor.getMetadataSerializer().mutateRepairedAt(descriptor, ActiveRepairService.UNREPAIRED_SSTABLE);
        }
View Full Code Here

    public long lastModified()
    {
        try
        {
            FileTime ft = Files.getLastModifiedTime(path,linkOptions);
            return ft.toMillis();
        }
        catch (IOException e)
        {
            LOG.ignore(e);
            return 0;
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.