public class HFileXML extends Object
Modifier and Type | Field and Description |
---|---|
FileOutputStream |
oof |
ObjectOutputStream |
oos |
File |
recordsFile |
Constructor and Description |
---|
HFileXML(String file)
Open a XML file to write or read objects to/from a serialized file in
sequential order.
|
HFileXML(String file,
String option)
Open a XML file to write or read objects to/from a serialized file in
sequential order.
|
HFileXML(String file,
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
|
Map<String,Object> |
getObjectMap()
Return objects stored in the form of a map.
|
Object |
read()
Get object from a file.
|
Object |
read(String key)
Read an object using a key if exits.
|
boolean |
write(Object ob)
Add an object to a XML file
|
boolean |
write(String key,
Object ob)
Add an object using a key.
|
public File recordsFile
public FileOutputStream oof
public ObjectOutputStream oos
public HFileXML(String file, 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(String file, 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(String file)
file
- File name for readingpublic boolean write(String key, Object ob)
key
- key to access the object.ob
- object to be inserted.public Map<String,Object> getObjectMap()
public int getBufferSize()
public boolean write(Object ob)
ob
- Objectkey
- key for objectpublic Object read()
public Object read(String key)
key
- public boolean close()
public int getEntries()
public void doc()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics