Interface FileSystemPort

All Known Implementing Classes:
LocalFileSystemAdapter

public interface FileSystemPort
Port for file system operations. This is an output port (drives file system).
  • Method Details

    • writeFile

      void writeFile(GeneratedFile file)
      Writes a file to the file system.
      Parameters:
      file - the file to write
      Throws:
      FileSystemPort.FileWriteException - if writing fails
    • writeFiles

      void writeFiles(List<GeneratedFile> files)
      Writes multiple files to the file system.
      Parameters:
      files - the files to write
      Throws:
      FileSystemPort.FileWriteException - if writing fails
    • createDirectory

      void createDirectory(Path path)
      Creates a directory.
      Parameters:
      path - the directory path
      Throws:
      FileSystemPort.FileWriteException - if creation fails
    • exists

      boolean exists(Path path)
      Checks if a path exists.
      Parameters:
      path - the path to check
      Returns:
      true if exists, false otherwise
    • directoryExists

      boolean directoryExists(Path path)
      Checks if a directory exists.
      Parameters:
      path - the directory path
      Returns:
      true if exists and is a directory, false otherwise
    • isProjectEmpty

      boolean isProjectEmpty(Path path)
      Checks if a directory is empty (only contains Gradle files).
      Parameters:
      path - the directory path
      Returns:
      true if empty or only contains allowed files, false otherwise
    • listFiles

      List<Path> listFiles(Path path)
      Lists files in a directory.
      Parameters:
      path - the directory path
      Returns:
      list of file paths
    • readFile

      String readFile(Path path)
      Reads the content of a file.
      Parameters:
      path - the file path
      Returns:
      the file content as string
      Throws:
      FileSystemPort.FileWriteException - if reading fails
    • appendToFile

      void appendToFile(Path path, String content)
      Appends content to an existing file.
      Parameters:
      path - the file path
      content - the content to append
      Throws:
      FileSystemPort.FileWriteException - if appending fails