package uk.ac.ebi.atlas.model.resource;

import java.io.IOException;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public abstract class AtlasResource<T> {

    protected final Path path;

    AtlasResource(Path path) {
        this.path = path;
    }

    public boolean exists() {
        return Files.exists(path);
    }

    public boolean existsAndIsNonEmpty() {
        return exists() && (
                path.toFile().isDirectory()
                        ? path.toFile().list().length > 0
                        : path.toFile().length() > 0
        );
    }

    public boolean isReadable() {
        return Files.isReadable(path);
    }

    public abstract T get();

    public Reader getReader() throws IOException {
        return Files.newBufferedReader(path, StandardCharsets.UTF_8);
    }

    public long size() {
        return path.toFile().length();
    }



    @Override
    public String toString() {
        return this.getClass().getName() + " with path " + path.toString();
    }

}

@@ -947,18 +947,16 @@
 %0A    %7D%0A%0A
-%0A%0A
     @Ove
@@ -1026,16 +1026,22 @@
 ss().get
+Simple
 Name() +

Simplify log messages in bioentities/buildIndex/status