[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-user
Subject:    Re: [groovy-user] How to easily read from System.in?
From:       Jim White <jim () pagesmiths ! com>
Date:       2008-11-28 5:08:10
Message-ID: 492F7CBA.7010308 () pagesmiths ! com
[Download RAW message or body]

This is a typical idiom:

System.in.withReader { println (it.readLine()) }

Jim

Claus Hausberger wrote:

> Hello
> 
> I want to port some old Perl scripts to Groovy. In those scripts I have to read a lot from System.in.
> 
> I got this program working:
> 
> 
> BufferedReader br = new BufferedReader(new InputStreamReader(System.in))
> print "input:"
> String input = br.readLine()
> println "input was:$input:"
> 
> 
> It does exactly what I want but I wanted to ask if there is a shorter, more Groovy way to do this.
> 
> 
> Claus


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic