Provide a better alternative to reading System.in

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Withdrawn
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • generic
    • generic

      Reading `System.in` is problematic as it is an input stream encoded in the host's encoding. With the JEP 400, there are cases where the default encoding (UTF-8) and host's native encoding differ. To read the bytes correctly, users would have to convert the bytes native-to-default, which seems to be an obstacle for basic usage. Providing a better means to access (w/o considering encoding stuff) would be appropriate. One option is to let users to use System.console(), but it won't work if the JVM is not attached to a console.

      Some possible options include:
      - Scanner.consoleScanner(): Returns Console.reader()
      - Reader.consoleReader(): Returns Console.reader()
      - System.inReader(): Returns Console.reader() if exists, otherwise a BufferedReader on System.in

            Assignee:
            Naoto Sato
            Reporter:
            Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: