标签:groovy utf-8 sqli new check pat 文本 with rap
File file = new File("out.txt")
println file.exists()
println file.canRead()
File file = new File("out.txt")
file.write "First line\n"
file << "Second line\n"
file.append("hello\n")
println file.text
File file = new File(‘examples/data/count_digits.txt‘) // 获取文件全部内容 println file.getText(‘UTF-8‘) println file.text // 获得文件的输入流 def inputStream = file.newInputStream()
File file = new File("/path/to/file")
// 第一种方法
def lines = file.readLines()
for (line in lines) {
// ...
}
// 第二种方法
file.eachLine { line, nb ->
println "Line $nb: $line"
}
File file = new File("/path/to/file");
// 获取文件修改时间
Long actualLastModified = file.lastModified();
// 设置文件修改时间
file.setLastModified(actualLastModified)
「Apache Groovy」- 运行 Shell 命令
「Groovy」- 处理 Object 与 JSON String 之间的转换
「Apache Groovy」- 连接 SQLite 数据库
「Groovy」- 操作 HTML 文档
「Groovy」- 彩色化输出日志
Groovy: reading and writing files - appending content
Working with IO
How to read a file in Groovy into a string? - Stack Overflow
json - Groovy file check - Stack Overflow
Set last modified timestamp of a file using jimfs in Java - Stack Overflow
「Groovy」- 操作文件(读取、写入) @20210223
标签:groovy utf-8 sqli new check pat 文本 with rap
原文地址:https://www.cnblogs.com/k4nz/p/14437660.html