By jlorenzen
via jlorenzen.blogspot.com
Published: Nov 30 2007 / 12:24
Using Groovy to work with Files
Tweet
SaveShareSend
Tags: how-to, java, open source, other languages
Comments
bloid replied ago:
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?
afsina replied ago:
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.
Voters For This Link (10)
Voters Against This Link (1)