Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4004086

java.io: Add support for simple input parsing

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P5
    • Resolution: Duplicate
    • Affects Version/s: 1.1, 1.1.7
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      solaris_2.5, windows_98

      Description

      There needs to be a class in java.io that can take ASCII/Unicode input from
      the keyboard for all the primitive types.

      Currently the only built-in support is for binary data. That is almost
      never what is wanted for terminal I/O.

      The class should be called something like PrintInputStream and it would
      read character date and assemble it into values of the primitive types.
      Currently, programmers are obliged to do this by hand, forming the worst
      possible impression on those new to the language. Even Pascal has better
      support than this. Even C has better support than this. Even C++ has better
      support than this.

      This is how we must currently read an integer from System.in

              import java.util.*;
              static DataInputStream dis = new DataInputStream( System.in );
              static StringTokenizer st;

          try {
              st=new StringTokenizer(dis.readLine());
              int myint = Integer.parseInt(st.nextToken());


      We have to offer something a bit better!

      peter.vanderlinden@Eng 1996-09-15

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mr Mark Reinhold
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: