Package: groovy.io

## [Java] Class PlatformLineWriter

- groovy.io.PlatformLineWriter

-     public class PlatformLineWriter
      extends Writer

  A buffered writer that gobbles any \r characters and replaces every \n with a platform specific newline. In many places Groovy normalises streams to only have \n characters but when creating files that must be used by other platform-aware tools, you sometimes want the newlines to match what the platform expects.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `PlatformLineWriter(Writer out)` Creates a writer that normalizes line endings for the platform.
    `PlatformLineWriter(Writer out, int sz)` Creates a writer that normalizes line endings for the platform.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `close()` {@inheritDoc}
    `` | `public void` | `flush()` {@inheritDoc}
    `` | `public void` | `write(char[] cbuf, int off, int len)` Writes characters while converting line endings to the platform format.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Writer` | `append, append, append, append, append, append, close, equals, flush, getClass, hashCode, notify, notifyAll, nullWriter, toString, wait, wait, wait, write, write, write, write, write`

- - ### Constructor Detail

    - #### public PlatformLineWriter(Writer out)

      Creates a writer that normalizes line endings for the platform.

      Parameters:
        `out` - the underlying writer

    - #### public PlatformLineWriter(Writer out, int sz)

      Creates a writer that normalizes line endings for the platform.

      Parameters:
        `out` - the underlying writer
        `sz` - the output buffer size

  - ### Method Detail

    - #### public void close()

      {@inheritDoc}

    - #### public void flush()

      {@inheritDoc}

    - #### public void write(char[] cbuf, int off, int len)

      Writes characters while converting line endings to the platform format.

      throws:
        IOException if an I/O error occurs
      Parameters:
        `cbuf` - the source buffer
        `off` - the buffer offset
        `len` - the number of characters to write