疑问
来源:5-6 groovy文件处理详解(下)

慕粉15633829639
2021-09-27
def saveObject(Object object, String path) {
try {
//创建目标文件
def desFile = new File(path)
if (!desFile.exists()) {
desFile.createNewFile()
}
desFile.withObjectOutputStream { out ->
out.writeObject(object)
}
return true
} catch (Exception e) {
e.printStackTrace()
}
return false
}
文件出来了,不知道为什么会有报错信息
写回答
1回答
-
具体是报啥错,看看文件内容是不是你想要的,如果是的话,就不是这块包的错, 如果与你的程序有关的话,麻烦贴一下报错信息,不然没法分析问题。
012021-09-29
相似问题