Java配置文件读取写入通用类库:PropUtils 属性文件类

本文介绍了一个Java工具类PropUtils,用于便捷地读取和写入.properties配置文件。提供了getProperties()方法来读取文件为Properties对象,saveProperties()方法保存Properties到指定路径,getConfigValue()获取键值,setConfigValue()设置键值。
摘要由CSDN通过智能技术生成

Java读取和修改properties文件

方法说明:

1.Properties getProperties(String filepath):根据路径读取属性文件,返回Properties类;

2.void saveProperties(Properties prop,String filepath):保存属性到指定路径(如果文件不存在,请先创建File);

3.String getConfigValue(String key):获取指定Key的属性;

4.void setConfigValue(String key,String value):设置指定Key的属性值。


/** 
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applic
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值