Reading and Writing to a properties file - Groovy Example,在gradle文件中读写properties文件内容

Reading and Writing to a properties file - Groovy Example,在gradle文件中读写properties文件内容,第1张

概述(转载)https://bowerstudios.com/node/1066 Create the properties object, and load it from the file system: Properties props = new Properties() File propsFile = new File('/usr/local/etc/test.properties') p

(转载)https://bowerstudios.com/node/1066

Create the propertIEs object,and load it from the file system:
PropertIEs props = new PropertIEs()
file propsfile = new file('/usr/local/etc/test.propertIEs')
props.load(propsfile.newDatainputStream())

Take a peek:
println props.getProperty('porcupine')

Write a new random value and persist it to the file system:
Integer rand = new Random().next(4)
props.setProperty('porcupine',rand.toString())
props.store(propsfile.newWriter(),null)

Peek again:
props.load(propsfile.newDatainputStream())println props.getProperty('porcupine')

总结

以上是内存溢出为你收集整理的Reading and Writing to a properties file - Groovy Example,在gradle文件读写properties文件内容全部内容,希望文章能够帮你解决Reading and Writing to a properties file - Groovy Example,在gradle文件中读写properties文件内容所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1249450.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存