Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
fs:io 命名空间下的 file/path 构造与 File/Path 扩展函数
java.io.File
java.nio.file.Path
import 'fs:io'
path
path(segment)
Path
path(parent,child)
Paths.get(parent, child)
file
file(path)
File
file(parent,child)
parent
logPath = path('logs/app.log') logFile = file('logs/app.log')
file('a.txt')::readText()
name()
path()
absolutePath()
canonicalPath()
parent()
parentFile()
toPath()
extension()
nameWithoutExtension()
exists()
isDirectory()
isFile()
length()
lastModified()
list()
listFiles()
walk(maxDepth?)
mkdir()
mkdirs()
createNewFile()
delete()
deleteOnExit()
deleteRecursively()
renameTo(target)
readText()
readLines()
readBytes()
writeText(text)
writeLines(lines)
List
toString()
writeBytes(bytes)
appendText(text)
FileWriter
copyTo(target,replaceExisting?)
Files.copy
replaceExisting
false
moveTo(target,replaceExisting?)
Files.move
copyRecursively(target,replaceExisting?)
File::toPath()
root()
resolve(other)
relativize(otherPath)
otherPath
normalize()
.
..
toAbsolutePath()
toRealPath()
toFile()
Files.exists
notExists()
Files.notExists
isRegularFile()
isSymbolicLink()
File::walk
import 'fs:io' projectDir = path('..', 'fluxon') logs = file(&projectDir, 'logs') &logs::mkdirs() info = file(&logs, 'latest.log') &info::writeLines(['Fluxon started', 'port=8080']) # 复制并归档 archive = file(&logs, 'latest.bak') &info::copyTo(&archive, true)