Interface ManagedDirectory

All Superinterfaces:
DirectoryBuilder, PathRoot

public interface ManagedDirectory extends DirectoryBuilder, PathRoot
Base interface for a managed directory, including the interfaces for creating fluent-style builders.
Since:
0.0.1
Author:
Ashley Scopes
  • Method Details

    • also

      Method that returns the object it is called upon to enable creating fluent-language builders.

      For example:

      
         thisDirectory
             .createFile("foo", "bar", "baz.txt").withContents(...)
             .and().also()
             .createFile("foo", "bar", "bork.txt").withContents(...);
       
      Returns:
      this object.
      See Also:
    • and

      default ManagedDirectory and()
      Method that returns the object it is called upon to enable creating fluent-language builders.

      For example:

      
         thisDirectory
             .createFile("foo", "bar", "baz.txt").withContents(...)
             .and()
             .createFile("foo", "bar", "bork.txt").withContents(...);
       
      Returns:
      this object.
      See Also:
    • close

      void close() throws IOException
      Close the resource.

      This specifically is not provided by implementing Closeable as to prevent IDEs giving false linting errors about not closing resources.

      Users should not need to call this directly if they are using instances produced from a Workspace implementation.

      Throws:
      IOException - if an IO exception occurs.
    • createDirectory

      default DirectoryBuilder createDirectory(String... fragments)
      Create a directory builder for the given path in this RAM file system.

      Examples:

      
         // Using platform-specific separators.
         dir.createDirectory("foo/bar/baz")...;
      
         // Letting JCT infer the correct path separators to use (recommended).
         dir.createDirectory("foo", "bar", "baz")...;
       
      Parameters:
      fragments - the parts of the path.
      Returns:
      the directory builder.
      Throws:
      IllegalArgumentException - if no path fragments are provided.
      NullPointerException - if any of the path fragments are null.
    • createDirectory

      Create a directory builder for the given path in this RAM file system.

      Examples:

      
         // Using platform-specific separators.
         dir.createDirectory(List.of("foo/bar/baz"))...;
      
         // Letting JCT infer the correct path separators to use (recommended).
         dir.createDirectory(List.of("foo", "bar", "baz"))...;
       
      Parameters:
      fragments - the parts of the path.
      Returns:
      the directory builder.
      Throws:
      IllegalArgumentException - if no path fragments are provided.
      NullPointerException - if any of the path fragments are null.
      Since:
      4.0.0
    • createFile

      default FileBuilder createFile(String... fragments)
      Create a file builder for the given path in this RAM file system.
      
         // Using platform-specific separators.
         dir.createFile("foo/bar/baz.txt")...;
      
         // Letting JCT infer the correct path separators to use (recommended).
         dir.createFile("foo", "bar", "baz.txt")...;
       
      Parameters:
      fragments - the parts of the path.
      Returns:
      the file builder.
      Throws:
      IllegalArgumentException - if no path fragments are provided.
      NullPointerException - if any of the path fragments are null.
    • createFile

      Create a file builder for the given path in this RAM file system.
      
         // Using platform-specific separators.
         dir.createFile(List.of("foo/bar/baz.txt"))...;
      
         // Letting JCT infer the correct path separators to use (recommended).
         dir.createFile(List.of("foo", "bar", "baz.txt"))...;
       
      Parameters:
      fragments - the parts of the path.
      Returns:
      the file builder.
      Throws:
      IllegalArgumentException - if no path fragments are provided.
      NullPointerException - if any of the path fragments are null.
      Since:
      4.0.0
    • getName

      Get the identifying name of the temporary file system.
      Returns:
      the identifier string.
    • then

      Method that returns the object it is called upon to enable creating fluent-language builders.

      For example:

      
         thisDirectory
             .createFile("foo", "bar", "baz.txt").withContents(...)
             .and().then()
             .createFile("foo", "bar", "bork.txt").withContents(...);
       
      Returns:
      this object.
      See Also: