«« Next » « Previous
«« Next » « Previous

Link Details

Open 24/7/365. Never a waiting line! Login and vote now.
Link 55252 thumbnail

By jlorenzen
via jlorenzen.blogspot.com
Published: Nov 30 2007 / 12:24

Using Groovy to work with Files
  • 10
  • 1
  • 1075
  • 275

Comments

Add your comment
User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

String file = new Scanner( new File( "test.txt" ) ).useDelimiter( "\\Z" ).next() ;

would surely be a shorter pure java method for loading a file into a String?

User 183924 avatar

afsina replied ago:

0 votes Vote down Vote up Reply

bloid: cool.

for the author:
Groovy code does not have the same behavior with the Java code, you dont need the exception handling in java code, throw it away. String file =.. line is also redundant.. i love when people deliberately writes more verbose code..
Java is not a scripting language.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (10)



Voters Against This Link (1)