org.apache.geronimo.gshell.command
Class IO

java.lang.Object
  extended by org.apache.geronimo.gshell.command.IO
Direct Known Subclasses:
RemoteIO

public class IO
extends Object

Container for input/output handles.

Version:
$Rev: 580765 $ $Date: 2007-09-30 11:52:39 -0700 (Sun, 30 Sep 2007) $

Nested Class Summary
static class IO.Verbosity
          Defines the valid values of the IO containers verbosity settings.
 
Field Summary
 PrintWriter err
          Prefered error output writer.
 OutputStream errorStream
          Raw error output stream.
 Reader in
          Prefered input reader.
 InputStream inputStream
          Raw input stream.
 PrintWriter out
          Prefered output writer.
 OutputStream outputStream
          Raw output stream.
 
Constructor Summary
IO()
          Helper which uses current values from System.
IO(InputStream in, OutputStream out)
          Construct a new IO container.
IO(InputStream in, OutputStream out, boolean autoFlush)
          Construct a new IO container.
IO(InputStream in, OutputStream out, OutputStream err)
          Construct a new IO container.
IO(InputStream in, OutputStream out, OutputStream err, boolean autoFlush)
          Construct a new IO container.
 
Method Summary
 void close()
          Close all streams.
 void debug(String msg)
           
 void debug(String format, Object... args)
           
 void error(String msg)
           
 void error(String format, Object... args)
           
 void flush()
          Flush both output streams.
 IO.Verbosity getVerbosity()
          Returns the verbosity level.
 void info(String msg)
           
 void info(String format, Object... args)
           
 boolean isDebug()
          Check if the verbosity level is set to IO.Verbosity.DEBUG.
 boolean isInfo()
          Check if the verbosity level is set to IO.Verbosity.INFO.
 boolean isQuiet()
          Check if the verbosity level is set to IO.Verbosity.QUIET.
 boolean isSharedOutputStreams()
           
 boolean isVerbose()
          Check if the verbosity level is set to IO.Verbosity.VERBOSE.
 void setVerbosity(IO.Verbosity verbosity)
          Set the verbosity level.
 String toString()
           
 void verbose(String msg)
           
 void verbose(String format, Object... args)
           
 void warn(String msg)
           
 void warn(String format, Object... args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inputStream

public final InputStream inputStream
Raw input stream.

See Also:
For general usage, please use the reader.

outputStream

public final OutputStream outputStream
Raw output stream.

See Also:
For general usage, please use the writer.

errorStream

public final OutputStream errorStream
Raw error output stream.

See Also:
For general usage, please use the writer.

in

public final Reader in
Prefered input reader.


out

public final PrintWriter out
Prefered output writer.


err

public final PrintWriter err
Prefered error output writer.

Constructor Detail

IO

public IO(InputStream in,
          OutputStream out,
          OutputStream err,
          boolean autoFlush)
Construct a new IO container.

Parameters:
in - The input steam; must not be null
out - The output stream; must not be null
err - The error output stream; must not be null
autoFlush - True to enable auto-flushing off writers.

IO

public IO(InputStream in,
          OutputStream out,
          OutputStream err)
Construct a new IO container.

Parameters:
in - The input steam; must not be null
out - The output stream; must not be null
err - The error output stream; must not be null

IO

public IO(InputStream in,
          OutputStream out,
          boolean autoFlush)
Construct a new IO container.

Parameters:
in - The input steam; must not be null
out - The output stream and error stream; must not be null
autoFlush - True to enable auto-flushing off writers.

IO

public IO(InputStream in,
          OutputStream out)
Construct a new IO container.

Parameters:
in - The input steam; must not be null
out - The output stream and error stream; must not be null

IO

public IO()
Helper which uses current values from System.

Method Detail

toString

public String toString()
Overrides:
toString in class Object

isSharedOutputStreams

public boolean isSharedOutputStreams()

setVerbosity

public void setVerbosity(IO.Verbosity verbosity)
Set the verbosity level.

Parameters:
verbosity -

getVerbosity

public IO.Verbosity getVerbosity()
Returns the verbosity level.


isQuiet

public boolean isQuiet()
Check if the verbosity level is set to IO.Verbosity.QUIET.


isInfo

public boolean isInfo()
Check if the verbosity level is set to IO.Verbosity.INFO.


isVerbose

public boolean isVerbose()
Check if the verbosity level is set to IO.Verbosity.VERBOSE.


isDebug

public boolean isDebug()
Check if the verbosity level is set to IO.Verbosity.DEBUG.

For generaly 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 IOException
Close all streams.

Throws:
IOException

debug

public void debug(String msg)

debug

public void debug(String format,
                  Object... args)

verbose

public void verbose(String msg)

verbose

public void verbose(String format,
                    Object... args)

info

public void info(String msg)

info

public void info(String format,
                 Object... args)

warn

public void warn(String msg)

warn

public void warn(String format,
                 Object... args)

error

public void error(String msg)

error

public void error(String format,
                  Object... args)


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.