从属性文件中删除键和值? [英] Delete key and value from a property file?

查看:149
本文介绍了从属性文件中删除键和值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除存储在属性文件中的键和值。我怎么能这样做????

I want to delete key and value which is stored in a property file. How can i do that????

推荐答案

首先 load() 使用 java。 util.Properties API。

First load() it using the java.util.Properties API.

Properties properties = new Properties();
properties.load(reader);

然后你可以使用 remove() 方法。

Then you can use the remove() method.

properties.remove(key);

最后 store() 它到文件。

And finally store() it to the file.

properties.store(writer, null);



参见:




  • 属性教程

  • See also:

    • Properties tutorial
    • 这篇关于从属性文件中删除键和值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆