This module provides a couple of function that requires java.nio package, which was introduced in j2sdk1.4.0.
When just input is specified, it returns a generator object that generates the all lines in turn.
scanLines() reads each line of a text file (input), and call handler passing a CharSequence object that represents each line. The differnece from readLines() is that the CharSequence object of a particular line will be broken or become inconsistent after the callback handler is called.
input must be either Reader, URL, File, or String object that represents a file name.
If includeLineSeparator is specified true, the
line separator (\r, \n, or \r\n) is kept in the parameter object; by default,
the line separator is stripped.
for (line : scanLines("template.txt"){
if (match(pattern, line)){
println(line)
break
}
}
charset() returns a java.nio.charset.Charset object that matches the specified charset name. It returns null if no charset is found.
charset("utf8")
charsets() returns a Map object that contains all available charsets; {charset_name -> Charset object}.
mapFile() creates a memory mapped file.
The 2nd argument (mode) The file mode "r" or "R" Read Only "w" or "W" Read/Write default Read Only