FileSystemInteractionImpl (Grails 6.0.0)

Package: grails.dev.commands.io

## [Groovy] Class FileSystemInteractionImpl

- grails.dev.commands.io.FileSystemInteractionImpl

- All Implemented Interfaces and Traits:
    grails.dev.commands.io.FileSystemInteraction

      @groovy.transform.CompileStatic
      class FileSystemInteractionImpl
      extends java.lang.Object
      implements grails.dev.commands.io.FileSystemInteraction

  Utility methods exposed to scripts for interacting with resources (found on the file system or jars) and the file system

  Authors:
    Graeme Rocher
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private java.io.File` | `baseDir` |
    `private ResourceLoader` | `resourceLoader` |
    `private ResourceLocator` | `resourceLocator` |
    `private PathMatchingResourcePatternResolver` | `resourcePatternResolver` |

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `java.io.File` | `baseDir`
    `org.springframework.core.io.ResourceLoader` | `resourceLoader`
    `ResourceLocator` | `resourceLocator`
    `org.springframework.core.io.support.PathMatchingResourcePatternResolver` | `resourcePatternResolver`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `FileSystemInteractionImpl (java.io.File baseDir, ResourceLoader resourceLoader)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `java.lang.String` | `className(Resource resource)` The class name of the given resource
    `` | `FileSystemInteractionImpl` | `copy(groovy.lang.Closure callable)` Allows Gradle style simple copy specs
    `` | `FileSystemInteractionImpl` | `copy(java.lang.Object path, java.lang.Object destination)` Copies a resource to the target destination
    `` | `FileSystemInteractionImpl` | `copy(Resource from, java.io.File to)` Copy a Resource from the given location to the given directory or location
    `` | `FileSystemInteractionImpl` | `copyAll(java.lang.Iterable resources, java.lang.Object destination)` Copies resources to the target destination
    `` | `FileSystemInteractionImpl` | `delete(java.lang.Object path)` Deletes a file
    `` | `java.io.File` | `file(java.lang.Object path)` Obtain a file for the given path
    `` | `java.util.Collection<java.io.File>` | `files(java.lang.String pattern)` Get files matching the given pattern
    `` | `java.io.File` | `getBuildDir()` Returns: The target build directory
    `` | `java.io.File` | `getClassesDir()` Returns: The directory where classes are compiled to
    `` | `java.io.File` | `getResourcesDir()` Returns: The directory where resources are processed to
    `` | `FileSystemInteractionImpl` | `mkdir(java.lang.Object path)` Makes a directory
    `` | `java.lang.String` | `projectPath(java.lang.Object path)` Obtain the path of the resource relative to the current project
    `` | `Resource` | `resource(java.lang.Object path)` Obtain a resource for the given path
    `` | `java.util.Collection<Resource>` | `resources(java.lang.String pattern)` Obtain resources for the given pattern
    `` | `Resource` | `source(java.lang.String className)` Finds a source file for the given class name

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private java.io.File baseDir

    - #### private ResourceLoader resourceLoader

    - #### private ResourceLocator resourceLocator

    - #### private PathMatchingResourcePatternResolver resourcePatternResolver

  - ### Property Detail

    - #### java.io.File baseDir

    - #### org.springframework.core.io.ResourceLoader resourceLoader

    - #### ResourceLocator resourceLocator

    - #### org.springframework.core.io.support.PathMatchingResourcePatternResolver resourcePatternResolver

  - ### Constructor Detail

    - #### FileSystemInteractionImpl(java.io.File baseDir, ResourceLoader resourceLoader)

  - ### Method Detail

    - #### java.lang.String className(Resource resource)

      The class name of the given resource

      Parameters:
        `resource` - The resource
      Returns:
        The class name

    - #### @java.lang.Override FileSystemInteractionImpl copy(@groovy.lang.DelegatesTo(value: FileSystemInteraction.CopySpec) groovy.lang.Closure callable)

      Allows Gradle style simple copy specs

      Parameters:
        `callable` - The callable
      Returns:
        this

    - #### @java.lang.Override FileSystemInteractionImpl copy(java.lang.Object path, java.lang.Object destination)

      Copies a resource to the target destination

      Parameters:
        `path` - The path
        `destination` - The destination

    - #### @java.lang.Override FileSystemInteractionImpl copy(Resource from, java.io.File to)

      Copy a Resource from the given location to the given directory or location

      Parameters:
        `from` - The resource to copy
        `to` - The location to copy to
      Returns:
        The {@FileSystemInteraction} instance

    - #### @java.lang.Override FileSystemInteractionImpl copyAll(java.lang.Iterable resources, java.lang.Object destination)

      Copies resources to the target destination

      Parameters:
        `path` - The path
        `destination` - The destination

    - #### @java.lang.Override FileSystemInteractionImpl delete(java.lang.Object path)

      Deletes a file

      Parameters:
        `path` - The path to the file

    - #### @java.lang.Override java.io.File file(java.lang.Object path)

      Obtain a file for the given path

      Parameters:
        `path` - The path
      Returns:
        The file

    - #### @java.lang.Override java.util.Collection<java.io.File> files(java.lang.String pattern)

      Get files matching the given pattern

      Parameters:
        `pattern` - The pattern
      Returns:
        the files

    - #### @java.lang.Override java.io.File getBuildDir()

      Returns:
        The target build directory

    - #### @java.lang.Override java.io.File getClassesDir()

      Returns:
        The directory where classes are compiled to

    - #### @java.lang.Override java.io.File getResourcesDir()

      Returns:
        The directory where resources are processed to

    - #### @java.lang.Override FileSystemInteractionImpl mkdir(java.lang.Object path)

      Makes a directory

      Parameters:
        `path` - The path to the directory

    - #### @java.lang.Override java.lang.String projectPath(java.lang.Object path)

      Obtain the path of the resource relative to the current project

      Parameters:
        `path` - The path to inspect
      Returns:
        The relative path

    - #### @java.lang.Override Resource resource(java.lang.Object path)

      Obtain a resource for the given path

      Parameters:
        `path` - The path
      Returns:
        The resource

    - #### @java.lang.Override java.util.Collection<Resource> resources(java.lang.String pattern)

      Obtain resources for the given pattern

      Parameters:
        `pattern` - The pattern
      Returns:
        The resources

    - #### @java.lang.Override Resource source(java.lang.String className)

      Finds a source file for the given class name

      Parameters:
        `className` - The class name
      Returns:
        The source resource