Class ConsolePrintDecorator

    • Constructor Detail

      • ConsolePrintDecorator

        public ConsolePrintDecorator​(Console console)
        Constructor.
        Parameters:
        console - the console to which data will be written
    • Method Detail

      • reader

        public Reader reader()
        Gets the Reader associated with the console. Invoking close() on this object will not close the underlying stream.
        Specified by:
        reader in interface Console
        Returns:
        the reader
        See Also:
        Console.reader()
      • format

        public ConsolePrintDecorator format​(Locale locale,
                                            String fmt,
                                            Object... args)
        Writes formatted String.
        Parameters:
        locale - The locale to apply during formatting. If it is null then no localization is applied.
        fmt - format String
        args - arguments to replace format specifiers in format String
        Returns:
        this ConsolePrintDecorator
      • print

        public void print​(boolean b)
        Prints a boolean value.
        Parameters:
        b - boolean to be printed
      • print

        public void print​(char c)
        Prints a character.
        Parameters:
        c - character to be printed
      • print

        public void print​(char[] s)
        Prints a character array.
        Parameters:
        s - character array to be printed
      • print

        public void print​(double d)
        Prints a double-precision floating-point number.
        Parameters:
        d - double-precision floating-point number to be printed
      • print

        public void print​(float f)
        Prints a floating-point number.
        Parameters:
        f - floating-point number to be printed
      • print

        public void print​(int i)
        Prints an integer.
        Parameters:
        i - the integer to be printed
      • print

        public void print​(long l)
        Prints a long integer.
        Parameters:
        l - the long integer to be printed
      • print

        public void print​(Object o)
        Prints an object.
        Parameters:
        o - the object to be printed
      • print

        public void print​(String s)
        Prints a string.
        Parameters:
        s - the string to be printed
      • printf

        public ConsolePrintDecorator printf​(Locale locale,
                                            String fmt,
                                            Object... args)
        Convenience method which writes formatted String.
        Parameters:
        locale - The locale to apply during formatting. If it is null then no localization is applied.
        fmt - format String
        args - arguments to replace format specifiers in format String
        Returns:
        this ConsolePrintDecorator
      • println

        public void println()
        Terminates the current line by writing the line separator string.
      • println

        public void println​(boolean b)
        Prints a boolean value and then terminates the line.
        Parameters:
        b - boolean to be printed
      • println

        public void println​(char c)
        Prints a character and then terminates the line.
        Parameters:
        c - character to be printed
      • println

        public void println​(char[] s)
        Prints a character array and then terminates the line.
        Parameters:
        s - character array to be printed
      • println

        public void println​(double d)
        Prints a double-precision floating-point number and then terminates the line.
        Parameters:
        d - double-precision floating-point number to be printed
      • println

        public void println​(float f)
        Prints a floating-point number and then terminates the line.
        Parameters:
        f - floating-point number to be printed
      • println

        public void println​(int i)
        Prints an integer and then terminates the line.
        Parameters:
        i - the integer to be printed
      • println

        public void println​(long l)
        Prints a long integer and then terminates the line.
        Parameters:
        l - the long integer to be printed
      • println

        public void println​(Object o)
        Prints an object and then terminates the line.
        Parameters:
        o - the object to be printed
      • println

        public void println​(String s)
        Prints a string and then terminates the line.
        Parameters:
        s - the string to be printed
      • readPassword

        public char[] readPassword​(String fmt,
                                   Object... args)
        Writes formatted prompt and reads password. Hidden input should be preferred if possible. Implementations which cannot hide input should display a warning that entered text will be visible.
        Specified by:
        readPassword in interface Console
        Parameters:
        fmt - format String
        args - arguments to replace format specifiers in format String
        Returns:
        the password
        See Also:
        Console.readPassword(String, Object...)
      • readPassword

        public char[] readPassword()
        Reads password. Hidden input should be preferred if possible. Implementations which cannot hide input should display a warning that entered text will be visible.
        Specified by:
        readPassword in interface Console
        Returns:
        the password
        See Also:
        Console.readPassword()
      • flush

        public void flush()
        Flushes this ConsoleStringDecorator by writing any buffered output.
        Specified by:
        flush in interface Flushable
      • append

        public ConsolePrintDecorator append​(CharSequence charSequence)
        Appends the specified character sequence.
        Specified by:
        append in interface Appendable
        Parameters:
        charSequence - the character sequence to append. If charSequence is null, then the four characters "null" are appended
      • append

        public ConsolePrintDecorator append​(CharSequence charSequence,
                                            int start,
                                            int end)
        Appends a subsequence of the specified character sequence.
        Specified by:
        append in interface Appendable
        Parameters:
        charSequence - the character sequence to append. If charSequence is null, then characters will be appended as if charSequence contained the four characters "null".
        start - index of the first character in the subsequence
        end - index of the character following the last character in the subsequence
      • checkError

        public boolean checkError()
        Flushes the underlying stream and checks its error state. Error state is set to true if underlying stream has encountered an IOException other than .InterruptedIOException
        Returns:
        true if underlying stream has encountered an IOException, else false