APIdia Launch Partner
Top Description Inners Fields Constructors Methods
java.io

pack-priv final Class ProxyingConsole

extends Console
Class Inheritance
Annotations
@ValueBased
Imports
java.nio.charset.Charset, java.util.Locale, java.util.function.Supplier, jdk.internal.ValueBased, jdk.internal.io.JdkConsole

Console implementation for internal use. Custom Console delegate may be provided with jdk.internal.io.JdkConsoleProvider.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final JdkConsole
private final LazyConstant<PrintWriter>
private final LazyConstant<Reader>
Inherited from java.io.Console:
TTY_STDERR_MASKTTY_STDIN_MASKTTY_STDOUT_MASK

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Charset
charset()

Overrides java.io.Console.charset.

Returns the Charset object used for the write operations on this Console.

public void
flush()

Overrides java.io.Console.flush.

Implements java.io.Flushable.flush.

Flushes the console and forces any buffered output to be written immediately.

public Console
format(String format, Object... args)

Overrides java.io.Console.format.

Writes a formatted string to this console's output stream using the specified format string and arguments with the default format locale.

public Console
format(Locale locale, String format, Object... args)

Overrides java.io.Console.format.

Writes a formatted string to this console's output stream using the specified format string and arguments with the specified locale.

public Console
printf(String format, Object... args)

Overrides java.io.Console.printf.

A convenience method to write a formatted string to this console's output stream using the specified format string and arguments with the default format locale.

public Console
printf(Locale locale, String format, Object... args)

Overrides java.io.Console.printf.

A convenience method to write a formatted string to this console's output stream using the specified format string and arguments with the specified locale.

public Reader
reader()

Overrides java.io.Console.reader.

Retrieves the unique Reader object associated with this console.

public String
readLine(String format, Object... args)

Overrides java.io.Console.readLine.

Provides a formatted prompt using the default format locale, then reads a single line of text from the console.

public String
readLine(Locale locale, String format, Object... args)

Overrides java.io.Console.readLine.

Provides a formatted prompt using the specified locale, then reads a single line of text from the console.

public String
readLine()

Overrides java.io.Console.readLine.

Reads a single line of text from the console.

public char[]
readPassword(String format, Object... args)

Overrides java.io.Console.readPassword.

Provides a formatted prompt using the default format locale, then reads a password or passphrase from the console with echoing disabled.

public char[]
readPassword(Locale locale, String format, Object... args)

Overrides java.io.Console.readPassword.

Provides a formatted prompt using the specified locale, then reads a password or passphrase from the console with echoing disabled.

public char[]
readPassword()

Overrides java.io.Console.readPassword.

Reads a password or passphrase from the console with echoing disabled.

public PrintWriter
writer()

Overrides java.io.Console.writer.

Retrieves the unique PrintWriter object associated with this console.

Inherited from java.io.Console:
isTerminal

Field Detail

delegateback to summary
private final JdkConsole delegate
printWriterback to summary
private final LazyConstant<PrintWriter> printWriter
readerback to summary
private final LazyConstant<Reader> reader

Constructor Detail

ProxyingConsoleback to summary
pack-priv ProxyingConsole(JdkConsole delegate)

Method Detail

charsetback to summary
public Charset charset()

Overrides java.io.Console.charset.

Doc from java.io.Console.charset.

Returns the Charset object used for the write operations on this Console.

The returned charset is used for encoding the data that is sent to the output (e.g., display), specified by the host environment or user. It defaults to the one based on stdout.encoding, and may not necessarily be the same as the default charset returned from Charset.defaultCharset().

Annotations
@Override
flushback to summary
public void flush()

Overrides java.io.Console.flush.

Implements java.io.Flushable.flush.

Doc from java.io.Console.flush.

Flushes the console and forces any buffered output to be written immediately.

Annotations
@Override
formatback to summary
public Console format(String format, Object... args)

Overrides java.io.Console.format.

Doc from java.io.Console.format.

Writes a formatted string to this console's output stream using the specified format string and arguments with the default format locale.

Annotations
@Override
formatback to summary
public Console format(Locale locale, String format, Object... args)

Overrides java.io.Console.format.

Doc from java.io.Console.format.

Writes a formatted string to this console's output stream using the specified format string and arguments with the specified locale.

Annotations
@Override
printfback to summary
public Console printf(String format, Object... args)

Overrides java.io.Console.printf.

Doc from java.io.Console.printf.

A convenience method to write a formatted string to this console's output stream using the specified format string and arguments with the default format locale.

Annotations
@Override
printfback to summary
public Console printf(Locale locale, String format, Object... args)

Overrides java.io.Console.printf.

Doc from java.io.Console.printf.

A convenience method to write a formatted string to this console's output stream using the specified format string and arguments with the specified locale.

Annotations
@Override
readerback to summary
public Reader reader()

Overrides java.io.Console.reader.

Doc from java.io.Console.reader.

Retrieves the unique Reader object associated with this console.

This method is intended to be used by sophisticated applications, for example, a java.util.Scanner object which utilizes the rich parsing/scanning functionality provided by the Scanner:

Console con = System.console(); if (con != null) { Scanner sc = new Scanner(con.reader()); code: }
Console con = System.console();
if (con != null) {
    Scanner sc = new Scanner(con.reader());
    ...
}

For simple applications requiring only line-oriented reading, use readLine.

The bulk read operations read(char[]), read(char[], int, int) and read(java.nio.CharBuffer) on the returned object will not read in characters beyond the line bound for each invocation, even if the destination buffer has space for more characters. The Reader's read methods may block if a line bound has not been entered or reached on the console's input device. A line bound is considered to be any one of a line feed ('\n'), a carriage return ('\r'), a carriage return followed immediately by a linefeed, or an end of stream.

Annotations
@Override
readLineback to summary
public String readLine(String format, Object... args)

Overrides java.io.Console.readLine.

Doc from java.io.Console.readLine.

Provides a formatted prompt using the default format locale, then reads a single line of text from the console.

Annotations
@Override
readLineback to summary
public String readLine(Locale locale, String format, Object... args)

Overrides java.io.Console.readLine.

Doc from java.io.Console.readLine.

Provides a formatted prompt using the specified locale, then reads a single line of text from the console.

Annotations
@Override
readLineback to summary
public String readLine()

Overrides java.io.Console.readLine.

Doc from java.io.Console.readLine.

Reads a single line of text from the console.

Annotations
@Override
readPasswordback to summary
public char[] readPassword(String format, Object... args)

Overrides java.io.Console.readPassword.

Doc from java.io.Console.readPassword.

Provides a formatted prompt using the default format locale, then reads a password or passphrase from the console with echoing disabled.

Annotations
@Override
readPasswordback to summary
public char[] readPassword(Locale locale, String format, Object... args)

Overrides java.io.Console.readPassword.

Doc from java.io.Console.readPassword.

Provides a formatted prompt using the specified locale, then reads a password or passphrase from the console with echoing disabled.

Annotations
@Override
readPasswordback to summary
public char[] readPassword()

Overrides java.io.Console.readPassword.

Doc from java.io.Console.readPassword.

Reads a password or passphrase from the console with echoing disabled.

Annotations
@Override
writerback to summary
public PrintWriter writer()

Overrides java.io.Console.writer.

Doc from java.io.Console.writer.

Retrieves the unique PrintWriter object associated with this console.

Annotations
@Override
java.io back to summary

private final Class ProxyingConsole.WrappingReader

extends Reader
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Reader
r

Inherited from java.io.Reader:
lock

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes the stream and releases any system resources associated with it.

public int
read(char[] cbuf, int off, int len)

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.

Inherited from java.io.Reader:
markmarkSupportednullReaderofreadreadreadreadAllAsStringreadAllLinesreadyresetskiptransferTo

Field Detail

rback to summary
private final Reader r

Constructor Detail

WrappingReaderback to summary
pack-priv WrappingReader(Reader r)

Method Detail

closeback to summary
public void close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Doc from java.io.Reader.close.

Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.

Annotations
@Override
readback to summary
public int read(char[] cbuf, int off, int len) throws IOException

Implements abstract java.io.Reader.read.

Doc from java.io.Reader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
java.io back to summary

private final Class ProxyingConsole.WrappingWriter

extends PrintWriter
Class Inheritance

Field Summary

Inherited from java.io.PrintWriter:
out

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.PrintWriter.close.

Implements java.io.Closeable.close.

Closes the stream and releases any system resources associated with it.

Inherited from java.io.PrintWriter:
appendappendappendcheckErrorclearErrorflushformatformatprintprintprintprintprintprintprintprintprintprintfprintfprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnprintlnsetErrorwritewritewritewritewrite

Constructor Detail

WrappingWriterback to summary
public WrappingWriter(PrintWriter pw)

Method Detail

closeback to summary
public void close()

Overrides java.io.PrintWriter.close.

Implements java.io.Closeable.close.

Doc from java.io.PrintWriter.close.

Closes the stream and releases any system resources associated with it. Closing a previously closed stream has no effect.

Annotations
@Override