public class Properties extends Object
Properties class
that uses a HashMap as the backing store.
Unlike the Java Properties class this class can only load/store to a line based UTF-8 text file. Serialization to/from XML files is not supported.
| Constructor and Description |
|---|
Properties() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all key/value pairs from the properties table.
|
String |
get(String key)
Returns a property value from the properties table.
|
Iterable<String> |
keys() |
void |
load(File file) |
void |
load(InputStream stream) |
void |
load(String path) |
protected void |
load(UTF8Reader utf8) |
void |
save(File file) |
void |
save(OutputStream stream) |
void |
save(String path) |
protected void |
save(UTF8Writer utf8) |
void |
set(String key,
String value)
Adds the key/value pair to the properties table.
|
int |
size()
Returns the number of key/value pairs contained in the properties table.
|
public void set(String key, String value)
key - The property to be set.value - The value the property will be set to.public String get(String key)
key - The property name.public void clear()
public int size()
public void save(String path) throws UnsupportedEncodingException, FileNotFoundException
public void save(File file) throws UnsupportedEncodingException, FileNotFoundException
public void save(OutputStream stream) throws UnsupportedEncodingException
UnsupportedEncodingExceptionprotected void save(UTF8Writer utf8)
public void load(String path) throws IOException, UnsupportedEncodingException
public void load(File file) throws IOException, UnsupportedEncodingException
public void load(InputStream stream) throws IOException, UnsupportedEncodingException
protected void load(UTF8Reader utf8) throws IOException
IOExceptionCopyright © 2016 The American National Corpus. All rights reserved.