public class Prop extends Object
Constructor and Description |
---|
Prop(File file)
Prop constructor.
|
Prop(File file,
String encoding)
Prop constructor
|
Prop(String fileName)
Prop constructor.
|
Prop(String fileName,
String encoding)
Prop constructor
|
Modifier and Type | Method and Description |
---|---|
Prop |
append(File file) |
Prop |
append(File file,
String encoding) |
Prop |
append(Prop prop) |
Prop |
append(String fileName) |
Prop |
append(String fileName,
String encoding) |
Prop |
appendIfExists(File file) |
Prop |
appendIfExists(File file,
String encoding) |
Prop |
appendIfExists(String fileName) |
Prop |
appendIfExists(String fileName,
String encoding) |
boolean |
containsKey(String key) |
String |
get(String key) |
String |
get(String key,
String defaultValue) |
Boolean |
getBoolean(String key) |
Boolean |
getBoolean(String key,
Boolean defaultValue) |
Integer |
getInt(String key) |
Integer |
getInt(String key,
Integer defaultValue) |
Long |
getLong(String key) |
Long |
getLong(String key,
Long defaultValue) |
Properties |
getProperties() |
public Prop(String fileName)
Prop(String, String)
public Prop(String fileName, String encoding)
Example:
Prop prop = new Prop("my_config.txt", "UTF-8");
String userName = prop.get("userName");
prop = new Prop("com/jfinal/file_in_sub_path_of_classpath.txt", "UTF-8");
String value = prop.get("key");
fileName
- the properties file's name in classpath or the sub directory of classpathencoding
- the encodingpublic Prop(File file)
Prop(File, String)
public boolean containsKey(String key)
public Properties getProperties()
Copyright © 2018. All rights reserved.