File 类介绍java
一、抽象路径名:File类提供抽象的,独立于系统的分级路径名闭包
D:/clat/test.groovy(注意抽象路径名使用/,不是/ )app
二、File能够表示文件或目录 对象
三、Groovy对java.io.File进行了加强(参考GDK Doc)递归
def toysFile = new File("src/TestToysFile.dat")字符串
if(!toysFile.exists()){get
toysFile.createNewFile()it
toysFile.append('Groovy and clat' + '/n')io
}test
四、File类的其余经常使用方法
写多个对象到文件的方法
一、基础知识:将对象序列化到文件时,若是多个对象序列化到同一个文件,会覆盖头部信息,使得读取对象失败,因此要作处理。
还未写demo,之后补充