public class HFileXML
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.io.FileOutputStream |
oof |
java.io.ObjectOutputStream |
oos |
java.io.File |
recordsFile |
Constructor and Description |
---|
HFileXML(java.lang.String file)
Open a XML file to write or read objects to/from a serialized file in
sequential order.
|
HFileXML(java.lang.String file,
java.lang.String option)
Open a XML file to write or read objects to/from a serialized file in
sequential order.
|
HFileXML(java.lang.String file,
java.lang.String option,
int bufferSize)
Open a XML 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
|
void |
doc()
Show online documentation.
|
int |
getBufferSize()
Get current buffer size for I/O.
|
int |
getEntries()
Get number of processed entries
|
java.util.Map<java.lang.String,java.lang.Object> |
getObjectMap()
Return objects stored in the form of a map.
|
java.lang.Object |
read()
Get object from a file.
|
java.lang.Object |
read(java.lang.String key)
Read an object using a key if exits.
|
boolean |
write(java.lang.Object ob)
Add an object to a XML file
|
boolean |
write(java.lang.String key,
java.lang.Object ob)
Add an object using a key.
|
public java.io.File recordsFile
public java.io.FileOutputStream oof
public java.io.ObjectOutputStream oos
public HFileXML(java.lang.String file, java.lang.String option, int bufferSize)
File extension is *.jxml
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.bufferSize
- set buffer size for I/O. It is best to use buffer sizes that
are multiples of 1024 bytes.public HFileXML(java.lang.String file, java.lang.String option)
file
- File nameoption
- Option to create the file . If "w" - write a file (or read)
file, if "r" only read created file.public HFileXML(java.lang.String file)
file
- File name for readingpublic boolean write(java.lang.String key, java.lang.Object ob)
key
- key to access the object.ob
- object to be inserted.public java.util.Map<java.lang.String,java.lang.Object> getObjectMap()
public int getBufferSize()
public boolean write(java.lang.Object ob)
ob
- Objectkey
- key for objectpublic java.lang.Object read()
public java.lang.Object read(java.lang.String key)
key
- public boolean close()
public int getEntries()
public void doc()
JHepSim. A part of HSTOOLS. version-1.2