public class PropKit extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
clear() |
static boolean |
containsKey(String key) |
static String |
get(String key) |
static String |
get(String key,
String defaultValue) |
static Boolean |
getBoolean(String key) |
static Boolean |
getBoolean(String key,
Boolean defaultValue) |
static Integer |
getInt(String key) |
static Integer |
getInt(String key,
Integer defaultValue) |
static Long |
getLong(String key) |
static Long |
getLong(String key,
Long defaultValue) |
static Prop |
getProp() |
static Prop |
getProp(String fileName) |
static Prop |
use(File file)
Using the properties file bye File object.
|
static Prop |
use(File file,
String encoding)
Using the properties file bye File object.
|
static Prop |
use(String fileName)
Using the properties file.
|
static Prop |
use(String fileName,
String encoding)
Using the properties file.
|
static Prop |
useless(String fileName) |
public static Prop use(String fileName)
use(String, String)public static Prop use(String fileName, String encoding)
Example:
PropKit.use("config.txt", "UTF-8");
PropKit.use("other_config.txt", "UTF-8");
String userName = PropKit.get("userName");
String password = PropKit.get("password");
userName = PropKit.use("other_config.txt").get("userName");
password = PropKit.use("other_config.txt").get("password");
PropKit.use("com/jfinal/config_in_sub_directory_of_classpath.txt");
fileName - the properties file's name in classpath or the sub directory of classpathencoding - the encodingpublic static Prop use(File file)
use(File, String)public static Prop use(File file, String encoding)
Example:
PropKit.use(new File("/var/config/my_config.txt"), "UTF-8");
Strig userName = PropKit.use("my_config.txt").get("userName");
file - the properties File objectencoding - the encodingpublic static void clear()
public static Prop getProp()
public static boolean containsKey(String key)
Copyright © 2015. All rights reserved.