zoukankan      html  css  js  c++  java
  • Properties的用法

    Properties是java的Legacy Collections(遗留集合)属性映射表(property map)是一个类型非常特殊的映射表结构。它有下面3个特性:
    • 键与值都是字符串。
    • 表可以保存到一个文件中,也可以从文件中加载。
    • 使用一个默认的辅助表。
    实现属性映射表的Java平台类称为Properties。
    属性映射表通常用于程序的特殊配置选项。

    Properties类表示的是一个属性集(里面可以放置一些属性集),Properties可以保存在流中store(OutputStream,String)

    File file = new File(//路径);
    FileOutputStream fos = null;
    fos = new FileOutputStream(file);
    Properties properties = new Properties();
    properties.store(fos,"comment");
    fos.close();

    或从流中加载load(InputStream)

    FileInputStream fis = null;
    File file = new File(//路径);
    fis = new FileInputStream(file);
    Properties properties = new Properties();
    properties.load(fis);
    fis.close();
    我很小我很弱,我在慢慢成长!
  • 相关阅读:
    asp.net 2.0 run
    Regular Expression
    assembly
    asp.net loading..
    session
    asp.net performance
    asp.net page order
    interface
    UVA 562 Dividing coins
    UVA 10003 Cutting Sticks
  • 原文地址:https://www.cnblogs.com/lvzhanhui/p/xiaoqiaolv_properties.html
Copyright © 2011-2022 走看看