public class HFile extends Object
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.
Constructor and Description |
---|
HFile(String file)
Open file for reading objects from a serialized file in sequential order.
|
HFile(String file,
String option)
Open file for reading objects from a serialized file in sequential order.
|
HFile(String file,
String option,
boolean compression)
Open a file to write/read objects to/from a serialized file in sequential
order.
|
HFile(String file,
String option,
boolean compression,
int bufferSize)
Open a file to write/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()
Return processed number of 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.
|
void |
setFlush(int reset)
Set after how many events data will be flushed.
|
boolean |
write(Object ob)
Add an object to a file
|
boolean |
write(String key,
Object ob)
Add an object using a key.
|
public HFile(String file, String option, boolean compression, int bufferSize)
You can also insert an object using a string key.
If the file name starts from http or ftp, we assume it is located on the Web and will attempt to read it from URL.
file
- File name. Can be located on URL if starts from http or ftp.option
- Option to create the file. If "w" - write a file (or read)
file, if "r" only read created file.compression
- if true, objects are compressed on-fly using GZIPbufferSize
- set buffer size for I/O. It is best to use buffer sizes that
are multiples of 1024 bytes.public HFile(String file, String option, boolean compression)
file
- File nameoption
- Option to create the file. If "w" - write a file (or read)
file, if "r" only read created file.compression
- if true, objects are compressed on-fly using GZIPbuffer
- set buffer size for I/O. It is best to use buffer sizes that
are multiples of 1024 bytes.public HFile(String file)
file
- File namepublic int getBufferSize()
public boolean write(String key, Object ob)
key
- key to access the object.ob
- object to be inserted.public boolean write(Object ob)
ob
- Objectkey
- key for objectpublic void setFlush(int reset)
reset
- after how many events data will be reset.public Map<String,Object> getObjectMap()
public int getEntries()
public Object read()
public Object read(String key)
key
- public boolean close()
public void doc()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics