Class OrderedProperties

java.lang.Object
com.acanx.util.properties.OrderedProperties

public class OrderedProperties extends Object
  • Constructor Details

    • OrderedProperties

      public OrderedProperties()
  • Method Details

    • load

      public void load(File file) throws IOException
      加载.properties配置文件
      Parameters:
      file - 文件
      Throws:
      IOException - 异常
    • load

      public void load(InputStream in) throws IOException
      加载.properties配置文件
      Parameters:
      in - 输入流
      Throws:
      IOException - 异常
    • getProperty

      public String getProperty(String key)
      获取属性值的方法
      Parameters:
      key - 键
      Returns:
    • getKeys

      public List<String> getKeys()
      获取所有键(可选功能)
      Returns:
      键值集合
    • setProperty

      public void setProperty(String key, String value)
      Parameters:
      key - 键
      value - 值
    • store

      public void store(OutputStream out) throws IOException
      Parameters:
      out - 输出流
      Throws:
      IOException - 异常
    • resortAndStore

      public void resortAndStore(File propFile) throws IOException
      将属性按键排序后写入文件,非属性条目(注释、空行)保留原始顺序
      Parameters:
      propFile - 输出文件
      Throws:
      IOException - 异常