On Tue, 19 Jan 1999 21:20:07 +0100, Sven Ruppert wrote:

>Hi,
>I have a problem...... (my english is too bad)
>so I try it in german
>Also ich habe folgendes Problem...
>Ich will schlicht und ergreifend die Tastatur 
>einlesen. Ein Synonym für ReadLn(); unter Pascal.
>Meine Suche brachten mich zur Methode readUTF.
>Ist die Richtung OK ?
>Es wäre super wenn mir jemand einen
>DemoQuelltext schicken könnte.

Here is a simple loop that will read from STDIN and
then output each line back out to STDOUT.

        import java.io.InputStreamReader;
        import java.io.BufferedReader;

        ...

        BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
        String data;

        while ((data=input.readLine()) != null)
        {
                System.out.println("--> " + data);
        }

This will do all of the locale correct work and for each line
of input, will echo back the line with "--> " pre-pended to it.
It exits at EOF or a thrown exception :-)


Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz

Reply via email to