当前位置: 首页 > news >正文

网易免费企业邮箱入口/seo运营做什么

网易免费企业邮箱入口,seo运营做什么,wordpress 添加js,u钙网免费设计头像在开发中常用properties文件来存储系统配置信息,下面就properties文件的读写,信息追加作简要介绍,顺便也解决乱码问题。 1、首先介绍一下properties类 properties类继承自Hashtable package com.gmi.client.util;import java.io.BufferedI…

在开发中常用properties文件来存储系统配置信息,下面就properties文件的读写,信息追加作简要介绍,顺便也解决乱码问题。
1、首先介绍一下properties类
properties类继承自Hashtable

package com.gmi.client.util;import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;/*** @author xiaoxin.tang**/
public class PropUtil {public static String readProperty(String file, String key) {InputStream is = null;FileInputStream fis = null;Properties prop = null;try {prop = new Properties();fis = new FileInputStream(file);is = new BufferedInputStream(fis);prop.load(is);String value = new String(prop.getProperty(key, "").getBytes("ISO-8859-1"), "UTF-8");return value;} catch (Exception e) {e.printStackTrace();return "";} finally {if (prop != null) prop = null;//fistry {if (fis != null) {fis.close();fis = null;}} catch (Exception e) {e.printStackTrace();}//istry {if (is != null) {is.close();is = null;}} catch (Exception e) {e.printStackTrace();}}}public static String readLocalProperty(String key) {String path = "";try {path = (PropUtil.class.getClassLoader().getResource("").toURI()).getPath();} catch (URISyntaxException e) {e.printStackTrace();}return readProperty(path + "conf.properties", key);}public static void writeProperty(String filename,String key,String value){FileInputStream fis = null;Properties properties = new Properties();try {fis = new FileInputStream(filename);BufferedReader bf = new BufferedReader(new InputStreamReader(fis,"UTF-8"));properties.load(bf);OutputStream out = new FileOutputStream(filename);BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out,"UTF-8"));properties.setProperty(key, value);properties.store(bw, "propertylist");out.close();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}public static void writeLocalProperty(String key,String value){String path = "";try {path = (PropUtil.class.getClassLoader().getResource("").toURI()).getPath();} catch (URISyntaxException e) {e.printStackTrace();}writeProperty(path+"conf.properties", key, value);}public static List<Integer> parseNum2List(String numStr) {List<Integer> list = new ArrayList<Integer>();StringBuilder sb = null;int len = numStr.length();for (int i = 0;i < len;i++) {char ch = numStr.charAt(i);if (Character.isDigit(ch)) {if(null == sb){sb = new StringBuilder();}sb.append(ch);} else {if (null != sb) {list.add(Integer.parseInt(sb.toString()));sb = null;}}}// Add the last numif (null != sb) {list.add(Integer.parseInt(sb.toString()));}return list;}}

获取部署项目的properties文件路径:PropUtil.class.getClassLoader().getResource(“”).toURI()).getPath();
配置信息追加:首先把properties文件中原有的信息load出来,然后在store,这样就不存在清空原信息的问题了
fis = new FileInputStream(filename);
BufferedReader bf = new BufferedReader(new InputStreamReader(fis,”UTF-8”));
properties.load(bf);
解决中文乱码问题:由于采用字节流提取/写回信息,打开properties后发现乱码问题,把字节流转换成字符流,问题就迎刃而解了!

http://www.lbrq.cn/news/941959.html

相关文章:

  • 做微信平台网站需要多少钱/磁力天堂最佳搜索引擎入口
  • 宁夏建设厅网站官网/seo就业前景如何
  • 哪个网站做服装批发比较好/百度首页登录官网
  • 金融理财网站建设方案/每天三分钟新闻天下事
  • 黑客收徒网站建设/网站的营销策略
  • 网站logo图怎么做的/深圳seo秘籍
  • php开源网站/室内设计师培训班学费多少
  • 做高级电工题的网站/沈阳seo博客
  • xp系统中做网站服务器/培训机构好还是学校好
  • 松江网站建设品划网络/网络媒体发稿平台
  • 淄博网站客户/百度seo优化软件
  • 微信如何建网站/永久免费个人网站申请注册
  • 测试网站访问速度/联赛积分榜排名
  • 合肥做网站可以吗/网站源码下载
  • wordpress如何写网站/广州网站优化公司排名
  • 外贸网站收录工具/搜索竞价
  • 自助建站系统建的网站做排名吗/推广网页怎么做的
  • 汝阳网站开发/saascrm国内免费pdf
  • 网络运维工程师需要掌握的技能/深圳网站优化推广
  • wordpress登录开发文档/关键词优化的价格查询
  • 重庆自助建站软件/单页网站模板
  • 普陀区网站建设公司哪家好/舆情分析报告模板
  • 套b网站/域名注册服务网站哪个好
  • asp.net 网站计数器/网络营销的概念和特点
  • 做网站要素/搜索引擎广告图片
  • 京网站建设公司/全网营销培训
  • 网站建设税费/网站怎样优化seo
  • 国外优秀的html5网站/soso搜搜
  • 网站建筑设计/免费建立个人网站凡科
  • 用dw可以做动态网站吗/找推网
  • Apache Doris Data Agent 解决方案:开启智能运维与数据治理新纪元
  • @PathVariable与@RequestParam的区别
  • TwinCAT3编程入门1
  • JAVA知识点(三):Spring与ORM框架
  • 安卓上的迷之K_1171477665
  • I/O多路复用机制中触发机制详细解析