public class PFile extends Object
Use this approach for storing P0D, P0I, P1D, H1D, H2D, F1D, F2D objects.
Constructor and Description |
---|
PFile(String file)
Open file for reading objects from a serialized file in sequential order.
|
PFile(String file,
String option)
Open file for reading objects from a serialized file in sequential order.
|
PFile(String file,
String option,
boolean mapNames)
Open a file to write/read objects to/from a file in sequential
order.
|
Modifier and Type | Method and Description |
---|---|
boolean |
close()
Close the file
|
void |
doc()
Show online documentation.
|
String |
entriesToString()
Get a string representing file content.
|
ArrayList<jhplot.io.PFile.FileEntry> |
getEntries()
Return file entries (ID,name,size).
|
int |
getNEntries()
Get number of objects stored in the file.
|
int |
getVersion()
Get version of the input file.
|
String |
listEntries()
List objects stored in the file.
|
boolean |
mapNames()
Generate an association between record number and object name.
|
Object |
read()
Read next object
|
Object |
read(int index)
Get object from a file using its index.
|
Object |
read(String name)
Get object from a file using its name.
|
int |
size()
Get number of objects stored in the file.
|
boolean |
write(Object ob)
Add an object to a file.
|
public PFile(String file, String option, boolean mapNames)
file
- File nameoption
- Option to create the file. If "w" - write a file (or read)
file, if "r" only read created file.mapnames
- set to true (slower) to make association between object name and its position in the record.
In this case, one can read objects as read(name). If file is large and you run over records
sequentially using ID, call with "false" for fast load.public PFile(String file)
file
- File namepublic boolean mapNames()
public int getVersion()
public boolean write(Object ob)
ob
- Objectpublic int size()
public int getNEntries()
public ArrayList<jhplot.io.PFile.FileEntry> getEntries()
public String entriesToString()
public Object read(String name)
name
- Name of the objectpublic Object read()
public String listEntries()
public Object read(int index)
index
- of the objectpublic boolean close()
public void doc()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics