public class HFileYAML extends Object
The data are accumulated in a map and written when you call the method close().
| Constructor and Description |
|---|
HFileYAML(String file)
Open a YAML file to read objects.
|
HFileYAML(String file,
String option)
Open a YAML file to write or read objects to/from a serialized file in
sequential order.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
close()
Close the file and write the objects as needed.
|
void |
doc()
Show online documentation.
|
int |
getEntries()
Get number of processed entries
|
Map<String,Object> |
getObjectMap()
Return objects stored in the form of a map.
|
org.yaml.snakeyaml.Yaml |
getYaml()
Return Yaml object from the file.
|
Object |
read(String key)
Read an object using a key if exits.
|
boolean |
write(String key,
Object ob)
Add an object using a key.
|
public HFileYAML(String file, String option)
File extension is *.yaml
You can also insert objects using the keys and read them back. In this case, avoid writing many objects without the keys since the extraction of keys will be very inefficient. Try not mix write/read with keys or without.
file - File nameoption - Option to create the file . If "w" - write a file (or read)
file, if "r" only read created file.public HFileYAML(String file)
file - File name for readingpublic org.yaml.snakeyaml.Yaml getYaml()
public boolean write(String key, Object ob)
key - key to access the object.ob - object to be inserted.public Map<String,Object> getObjectMap()
public Object read(String key)
key - public boolean close()
public int getEntries()
public void doc()
DMelt 2.0 © DataMelt by jWork.ORG