Class 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  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.io.PrintWriter err
      Prefered error output writer.
      java.io.OutputStream errorStream
      Raw error output stream.
      java.io.Reader in
      Prefered input reader.
      java.io.InputStream inputStream
      Raw input stream.
      java.io.PrintWriter out
      Prefered output writer.
      java.io.OutputStream outputStream
      Raw output stream.
    • Constructor Summary

      Constructors 
      Constructor Description
      IO()
      Construct a new IO container using system streams.
      IO​(java.io.InputStream inputStream, java.io.OutputStream outputStream, java.io.OutputStream errorStream)
      Construct a new IO container.
    • Field Detail

      • inputStream

        public final java.io.InputStream inputStream
        Raw input stream.
      • outputStream

        public final java.io.OutputStream outputStream
        Raw output stream.
      • errorStream

        public final java.io.OutputStream errorStream
        Raw error output stream.
      • in

        public final java.io.Reader in
        Prefered input reader.
      • out

        public final java.io.PrintWriter out
        Prefered output writer.
      • err

        public final java.io.PrintWriter err
        Prefered error output writer.
    • Constructor Detail

      • 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 Detail

      • 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 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.IOException
        Close all streams.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException