All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.container.jdisc.state.FileWrapper Maven / Gradle / Ivy

There is a newer version: 8.458.13
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc.state;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
import java.util.stream.Stream;

/**
 * @author olaa
 */
public class FileWrapper {

    long getFileAgeInSeconds(Path path) throws IOException {
        Instant lastModifiedTime = Files.getLastModifiedTime(path).toInstant();
        return Instant.now().getEpochSecond() - lastModifiedTime.getEpochSecond();
    }

    Stream walkTree(Path path) throws IOException {
        return Files.walk(path);
    }

    boolean isRegularFile(Path path) {
        return Files.isRegularFile(path);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy