Interface Footprint

  • All Known Implementing Classes:
    FtCached, FtDefault

    public interface Footprint
    Footprint is a term used to refer to a trace of an EO program on the file system.

    It's a fitting analogy with the word's natural meaning, and what it essentially does is trace files that have a specific extension. Footprint enables you to do the following: - Save files that have a specific extension - Load files that have a specific extension - Get a complete list of files that have a specific extension

    You can find a full list of available methods below.

    Since Footprint can leave traces on the file system, each Footprint instance will have its own unique way of saving and loading files, and it will have its own place to do so. For instance, FtDefault will save files directly to a specific location on the file system, while FtCached will first check the cache directory before delegating the behavior. In other words, Footprint provides useful functionality for working with files that have different extensions.

    Since:
    1.0
    • Method Detail

      • load

        String load​(String program,
                    String ext)
             throws IOException
        Get program content of a specific type.

        That is, if the file contains "hello", it will return the string "hello".

        Parameters:
        program - Program name
        ext - File extension which defines the type
        Returns:
        Content of a file
        Throws:
        IOException - In case of IO issue.
      • save

        void save​(String program,
                  String ext,
                  org.cactoos.Scalar<String> content)
           throws IOException
        Save content.

        Leaves a "footprint" in the directory. So it can create a new file in the file system. Where it will create this file depends on the implementation.

        Parameters:
        program - Program name
        ext - File extension
        content - File content
        Throws:
        IOException - In case of IO issues
      • list

        List<Path> list​(String ext)
                 throws IOException
        Get list of saved regular files with ext.
        Parameters:
        ext - File extension
        Returns:
        List of files
        Throws:
        IOException - In case of IO issues