Skip to content

Commit 50a8870

Browse files
committed
BAEL-2659 - Reading a file in Groovy - added more example
1 parent 1f4d183 commit 50a8870

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎core-groovy/src/main/groovy/com/baeldung/file/ReadFile.groovy‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ class ReadFile {
6969
* @return
7070
*/
7171
def moreExamples() {
72+
73+
new File("src/main/resources/utf8Content.html").withReader('UTF-8') { reader ->
74+
def line
75+
while ((line = reader.readLine())!=null) {
76+
println "${line}"
77+
}
78+
}
79+
7280
def list = new File("src/main/resources/fileContent.txt").collect {it}
7381

7482
def array = new File("src/main/resources/fileContent.txt") as String[]

0 commit comments

Comments
 (0)