Skip to content
Go to file
Cannot retrieve contributors at this time
62 lines (44 sloc) 2.93 KB

PRs Welcome License Build Status


Text-IO is a library for creating Java console applications. It can be used in applications that need to read interactive input from the user.


  • supports reading values with various data types.
  • allows masking the input when reading sensitive data.
  • allows selecting a value from a list.
  • allows to specify constraints on the input values (format patterns, value ranges, length constraints etc.).
  • provides different terminal implementations and offers a Service Provider Interface (SPI) for configuring additional text terminals.

By default, Text-IO tries to use text terminals backed by If no console device is present (which may happen, for example, when running the application in your IDE), a Swing-based terminal is used instead.


TextIO textIO = TextIoFactory.getTextIO();

String user = textIO.newStringInputReader()

String password = textIO.newStringInputReader()

int age = textIO.newIntInputReader()

Month month = textIO.newEnumInputReader(Month.class)
        .read("What month were you born in?");

TextTerminal terminal = textIO.getTextTerminal();
terminal.printf("\nUser %s is %d years old, was born in %s and has the password %s.\n",
        user, age, month, password);

Click on the image below to see the output of the above example in a Swing-based terminal.

You can also use a web-based terminal, which allows you to access your application via a browser, as shown in the image below.

Useful links

Text-IO is available in Maven Central and JCenter.

You can’t perform that action at this time.