Package org.codehaus.groovy.tools.shell
Class IO
java.lang.Object
org.codehaus.groovy.tools.shell.IO
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class IO
extends java.lang.Object
implements java.io.Closeable
Container for input/output handles.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IO.Verbosity
Verbosity for simple logging: QUIET, INFO, VERBOSE, DEBUG -
Field Summary
Fields Modifier and Type Field Description boolean
ansiSupported
Whether ansi support is availablejava.io.PrintWriter
err
Preferred error output writer.java.io.OutputStream
errorStream
Raw error output stream.java.io.Reader
in
Preferred input reader.java.io.InputStream
inputStream
Raw input stream.java.io.PrintWriter
out
Preferred output writer.java.io.OutputStream
outputStream
Raw output stream. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
close()
Close all streams.void
flush()
Flush both output streams.IO.Verbosity
getVerbosity()
Returns the verbosity level.boolean
isDebug()
Check if the verbosity level is set toIO.Verbosity.DEBUG
.boolean
isInfo()
Check if the verbosity level is set toIO.Verbosity.INFO
.boolean
isQuiet()
Check if the verbosity level is set toIO.Verbosity.QUIET
.boolean
isVerbose()
Check if the verbosity level is set toIO.Verbosity.VERBOSE
.void
setVerbosity(IO.Verbosity verbosity)
Set the verbosity level.protected java.io.PrintWriter
tryConstructRenderWriter(java.io.OutputStream stream)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
inputStream
public final java.io.InputStream inputStreamRaw input stream. -
outputStream
public final java.io.OutputStream outputStreamRaw output stream. -
errorStream
public final java.io.OutputStream errorStreamRaw error output stream. -
in
public final java.io.Reader inPreferred input reader. -
out
public final java.io.PrintWriter outPreferred output writer. -
err
public final java.io.PrintWriter errPreferred error output writer. -
ansiSupported
public final boolean ansiSupportedWhether ansi support is available
-
-
Constructor Details
-
IO
public IO(java.io.InputStream inputStream, java.io.OutputStream outputStream, java.io.OutputStream errorStream)Construct a new IO container. -
IO
public IO()Construct a new IO container using system streams.
-
-
Method Details
-
tryConstructRenderWriter
protected java.io.PrintWriter tryConstructRenderWriter(java.io.OutputStream stream) -
setVerbosity
Set the verbosity level. -
getVerbosity
Returns the verbosity level. -
isQuiet
public boolean isQuiet()Check if the verbosity level is set toIO.Verbosity.QUIET
. -
isInfo
public boolean isInfo()Check if the verbosity level is set toIO.Verbosity.INFO
. -
isVerbose
public boolean isVerbose()Check if the verbosity level is set toIO.Verbosity.VERBOSE
. -
isDebug
public boolean isDebug()Check if the verbosity level is set toIO.Verbosity.DEBUG
.For general usage, when debug output is required, it is better to use the logging facility instead.
-
flush
public void flush()Flush both output streams. -
close
public void close() throws java.io.IOExceptionClose all streams.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-