FileSystemResource (Grails 6.0.0)

Package: org.grails.io.support

## [Java] Class FileSystemResource

- org.grails.io.support.FileSystemResource

- All Implemented Interfaces and Traits:
    org.springframework.core.io.Resource

      public class FileSystemResource
      extends java.lang.Object
      implements org.springframework.core.io.Resource

  Based on Spring FileSystemResource implementation.

  Authors:
    Juergen Hoeller
    Graeme Rocher
  Since:
    28.12.2003
  See Also:
    java.io.File

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private java.io.File` | `file` |
    `private java.lang.String` | `path` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `FileSystemResource (java.io.File file)` Create a new FileSystemResource from a File handle.
    `FileSystemResource (java.lang.String path)` Create a new FileSystemResource from a file path.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected void` | `assertNotNull(java.lang.Object object, java.lang.String message)`
    `` | `public long` | `contentLength()` This implementation returns the underlying File's length.
    `` | `public Resource` | `createRelative(java.lang.String relativePath)` This implementation creates a FileSystemResource, applying the given path relative to the path of the underlying file of this resource descriptor.
    `` | `public boolean` | `equals(java.lang.Object obj)` This implementation compares the underlying File references.
    `` | `public boolean` | `exists()` This implementation returns whether the underlying file exists.
    `` | `public java.lang.String` | `getDescription()` This implementation returns a description that includes the absolute path of the file.
    `` | `public java.io.File` | `getFile()` This implementation returns the underlying File reference.
    `` | `public java.lang.String` | `getFilename()` This implementation returns the name of the file.
    `` | `public java.io.InputStream` | `getInputStream()` This implementation opens a FileInputStream for the underlying file.
    `` | `public java.io.OutputStream` | `getOutputStream()` This implementation opens a FileOutputStream for the underlying file.
    `` | `public final java.lang.String` | `getPath()` Return the file path for this resource.
    `` | `public java.net.URI` | `getURI()` This implementation returns a URI for the underlying file.
    `` | `public java.net.URL` | `getURL()` This implementation returns a URL for the underlying file.
    `` | `public int` | `hashCode()` This implementation returns the hash code of the underlying File reference.
    `` | `public boolean` | `isReadable()` This implementation checks whether the underlying file is marked as readable (and corresponds to an actual file with content, not to a directory).
    `` | `public boolean` | `isWritable()` This implementation checks whether the underlying file is marked as writable (and corresponds to an actual file with content, not to a directory).
    `` | `public long` | `lastModified()`
    `` | `public java.lang.String` | `toString()`

  - ### 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 final java.io.File file

    - #### private final java.lang.String path

  - ### Constructor Detail

    - #### public FileSystemResource(java.io.File file)

      Create a new FileSystemResource from a File handle.

      Parameters:
        `file` - a File handle

    - #### public FileSystemResource(java.lang.String path)

      Create a new FileSystemResource from a file path.

      Parameters:
        `path` - a file path

  - ### Method Detail

    - #### protected void assertNotNull(java.lang.Object object, java.lang.String message)

    - #### public long contentLength()

      This implementation returns the underlying File's length.

    - #### public Resource createRelative(java.lang.String relativePath)

      This implementation creates a FileSystemResource, applying the given path relative to the path of the underlying file of this resource descriptor.

    - #### @java.lang.Override public boolean equals(java.lang.Object obj)

      This implementation compares the underlying File references.

    - #### public boolean exists()

      This implementation returns whether the underlying file exists.

      See Also:
        java.io.File#exists()

    - #### public java.lang.String getDescription()

      This implementation returns a description that includes the absolute path of the file.

      See Also:
        java.io.File#getAbsolutePath()

    - #### public java.io.File getFile()

      This implementation returns the underlying File reference.

    - #### public java.lang.String getFilename()

      This implementation returns the name of the file.

      See Also:
        java.io.File#getName()

    - #### public java.io.InputStream getInputStream()

      This implementation opens a FileInputStream for the underlying file.

      See Also:
        java.io.FileInputStream

    - #### public java.io.OutputStream getOutputStream()

      This implementation opens a FileOutputStream for the underlying file.

      See Also:
        java.io.FileOutputStream

    - #### public final java.lang.String getPath()

      Return the file path for this resource.

    - #### public java.net.URI getURI()

      This implementation returns a URI for the underlying file.

      See Also:
        java.io.File#toURI()

    - #### public java.net.URL getURL()

      This implementation returns a URL for the underlying file.

      See Also:
        java.io.File#toURI()

    - #### @java.lang.Override public int hashCode()

      This implementation returns the hash code of the underlying File reference.

    - #### public boolean isReadable()

      This implementation checks whether the underlying file is marked as readable (and corresponds to an actual file with content, not to a directory).

      See Also:
        java.io.File#canRead()
        java.io.File#isDirectory()

    - #### public boolean isWritable()

      This implementation checks whether the underlying file is marked as writable (and corresponds to an actual file with content, not to a directory).

      See Also:
        java.io.File#canWrite()
        java.io.File#isDirectory()

    - #### public long lastModified()

    - #### @java.lang.Override public java.lang.String toString()