Package: org.codehaus.groovy.runtime

## [Java] Class WritableFile

- org.codehaus.groovy.runtime.WritableFile

- All Implemented Interfaces and Traits:
    Writable

      public class WritableFile
      extends File
      implements Writable

  A file wrapper implementing the Writable interface to support writing file contents. Allows a file to be written to any output stream, optionally with a specified character encoding.

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class File` | `separatorChar, separator, pathSeparatorChar, pathSeparator`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `WritableFile(File delegate)` Constructs a WritableFile from a delegate File with default character encoding.
    `WritableFile(File delegate, String encoding)` Constructs a WritableFile from a delegate File with optional character encoding.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Writer` | `writeTo(Writer out)` Writes this file's contents to the specified Writer.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class File` | `canExecute, canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getClass, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, notify, notifyAll, renameTo, setExecutable, setExecutable, setLastModified, setReadOnly, setReadable, setReadable, setWritable, setWritable, toPath, toString, toURI, toURL, wait, wait, wait`

- - ### Constructor Detail

    - #### public WritableFile(File delegate)

      Constructs a WritableFile from a delegate File with default character encoding.

      Parameters:
        `delegate` - the underlying File to wrap

    - #### public WritableFile(File delegate, String encoding)

      Constructs a WritableFile from a delegate File with optional character encoding.

      Parameters:
        `delegate` - the underlying File to wrap
        `encoding` - the character encoding to use when reading the file, or `null` for default

  - ### Method Detail

    - #### public Writer writeTo(Writer out)

      Writes this file's contents to the specified Writer. If encoding was specified, uses that encoding when reading the file.

      throws:
        IOException if an I/O error occurs during reading or writing
      Parameters:
        `out` - the Writer to write the file contents to
      Returns:
        the same Writer for method chaining