Package: org.codehaus.groovy.tools.shell

## [Java] Class IO

- org.codehaus.groovy.tools.shell.IO

- All Implemented Interfaces and Traits:
    Closeable

      public class IO
      extends Object
      implements Closeable

  Container for input/output handles.

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `IO.Verbosity` | Verbosity for simple logging: QUIET, INFO, VERBOSE, DEBUG

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `boolean` | `ansiSupported` | Whether ansi support is available
    `PrintWriter` | `err` | Preferred error output writer.
    `OutputStream` | `errorStream` | Raw error output stream.
    `Reader` | `in` | Preferred input reader.
    `InputStream` | `inputStream` | Raw input stream.
    `PrintWriter` | `out` | Preferred output writer.
    `OutputStream` | `outputStream` | Raw output stream.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `IO(InputStream inputStream, OutputStream outputStream, OutputStream errorStream)` Construct a new IO container.
    `IO()` Construct a new IO container using system streams.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `close()` Close all streams.
    `` | `public void` | `flush()` Flush both output streams.
    `` | `public IO.Verbosity` | `getVerbosity()` Returns the verbosity level.
    `` | `public boolean` | `isDebug()` Check if the verbosity level is set to Verbosity.DEBUG.
    `` | `public boolean` | `isInfo()` Check if the verbosity level is set to Verbosity.INFO.
    `` | `public boolean` | `isQuiet()` Check if the verbosity level is set to Verbosity.QUIET.
    `` | `public boolean` | `isVerbose()` Check if the verbosity level is set to Verbosity.VERBOSE.
    `` | `public void` | `setVerbosity(IO.Verbosity verbosity)` Set the verbosity level.
    `` | `protected PrintWriter` | `tryConstructRenderWriter(OutputStream stream)` Attempts to create an ANSI-aware writer for the supplied stream.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### public final boolean ansiSupported

      Whether ansi support is available

    - #### public final PrintWriter err

      Preferred error output writer.

    - #### public final OutputStream errorStream

      Raw error output stream.

    - #### public final Reader in

      Preferred input reader.

    - #### public final InputStream inputStream

      Raw input stream.

    - #### public final PrintWriter out

      Preferred output writer.

    - #### public final OutputStream outputStream

      Raw output stream.

  - ### Constructor Detail

    - #### public IO(InputStream inputStream, OutputStream outputStream, OutputStream errorStream)

      Construct a new IO container.

    - #### public IO()

      Construct a new IO container using system streams.

  - ### Method Detail

    - #### public void close()

      Close all streams.

    - #### public void flush()

      Flush both output streams.

    - #### public IO.Verbosity getVerbosity()

      Returns the verbosity level.

    - #### public boolean isDebug()

      Check if the verbosity level is set to Verbosity.DEBUG.

      For general usage, when debug output is required, it is better to use the logging facility instead.

    - #### public boolean isInfo()

      Check if the verbosity level is set to Verbosity.INFO.

    - #### public boolean isQuiet()

      Check if the verbosity level is set to Verbosity.QUIET.

    - #### public boolean isVerbose()

      Check if the verbosity level is set to Verbosity.VERBOSE.

    - #### public void setVerbosity(IO.Verbosity verbosity)

      Set the verbosity level.

    - #### protected PrintWriter tryConstructRenderWriter(OutputStream stream)

      Attempts to create an ANSI-aware writer for the supplied stream.

      Parameters:
        `stream` - the output stream to wrap
      Returns:
        an ANSI render writer, or `null` if ANSI support is unavailable