Package: java.io

## Class Writer

- - ### Methods Summary

    Methods
    Return type | Name and parameters
    --- | ---
    `Writer` | `leftShift(Object value)` Overloads the leftShift operator for Writer to allow an object to be written using Groovy's default representation for the object.
    `PrintWriter` | `newPrintWriter()` Create a new PrintWriter for this Writer.
    `Object` | `withPrintWriter(Closure closure)` Create a new PrintWriter for this Writer.
    `Object` | `withWriter(Closure closure)` Allows this writer to be used within the closure, ensuring that it is flushed and closed before this method returns.
    `void` | `write(Writable writable)` A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface.

  - #### Methods inherited from class java.lang.Object

    `addShutdownHook`, `any`, `any`, `asBoolean`, `asType`, `collect`, `collect`, `collect`, `contains`, `count`, `dump`, `each`, `eachWithIndex`, `equals`, `every`, `every`, `find`, `find`, `findAll`, `findAll`, `findIndexOf`, `findIndexOf`, `findIndexValues`, `findIndexValues`, `findLastIndexOf`, `findLastIndexOf`, `findResult`, `findResult`, `flatten`, `getAt`, `getMetaClass`, `getMetaPropertyValues`, `getProperties`, `grep`, `grep`, `groupBy`, `groupBy`, `hasProperty`, `identity`, `inject`, `inject`, `inspect`, `invokeMethod`, `is`, `isCase`, `iterator`, `join`, `metaClass`, `print`, `print`, `printf`, `printf`, `println`, `println`, `println`, `putAt`, `respondsTo`, `respondsTo`, `setMetaClass`, `size`, `split`, `sprintf`, `sprintf`, `sum`, `sum`, `tap`, `toArrayString`, `toSpreadMap`, `toString`, `use`, `use`, `use`, `with`, `with`, `withTraits`

  - #### Methods inherited from interface java.lang.Appendable

    `leftShift`, `withFormatter`, `withFormatter`

  - #### Methods inherited from interface java.io.Closeable

    `withCloseable`

  - #### Methods inherited from interface java.lang.AutoCloseable

    `withCloseable`

- - ### Methods Detail

    - #### public Writer leftShift(Object value)

      Overloads the leftShift operator for Writer to allow an object to be written using Groovy's default representation for the object.

      Parameters:
        `value` - an Object whose default representation will be written to the Writer
      Returns:
        the writer on which this operation was invoked
      Since:
        1.0

    - #### public PrintWriter newPrintWriter()

      Create a new PrintWriter for this Writer.

      Returns:
        a PrintWriter
      Since:
        1.6.0

    - #### public Object withPrintWriter(Closure closure)

      Create a new PrintWriter for this Writer. The writer is passed to the closure, and will be closed before this method returns.

      Parameters:
        `closure` - the closure to invoke with the PrintWriter
      Returns:
        the value returned by the closure
      Since:
        1.6.0

    - #### public Object withWriter(Closure closure)

      Allows this writer to be used within the closure, ensuring that it is flushed and closed before this method returns.

      Parameters:
        `closure` - the closure that the writer is passed into
      Returns:
        the value returned by the closure
      Since:
        1.5.2

    - #### public void write(Writable writable)

      A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface.

      Parameters:
        `writable` - an object implementing the Writable interface
      Since:
        1.0