public class PFile
extends java.lang.Object
Use this approach for storing P0D, P0I, P1D, H1D, H2D, F1D, F2D objects.
Constructor and Description |
---|
PFile(java.lang.String file)
Open file for reading objects from a serialized file in sequential order.
|
PFile(java.lang.String file,
java.lang.String option)
Open file for reading objects from a serialized file in sequential order.
|
PFile(java.lang.String file,
java.lang.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.
|
java.lang.String |
entriesToString()
Get a string representing file content.
|
java.util.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.
|
java.lang.String |
listEntries()
List objects stored in the file.
|
boolean |
mapNames()
Generate an association between record number and object name.
|
java.lang.Object |
read()
Read next object
|
java.lang.Object |
read(int index)
Get object from a file using its index.
|
java.lang.Object |
read(java.lang.String name)
Get object from a file using its name.
|
int |
size()
Get number of objects stored in the file.
|
boolean |
write(java.lang.Object ob)
Add an object to a file.
|
public PFile(java.lang.String file, java.lang.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(java.lang.String file)
file
- File namepublic PFile(java.lang.String file, java.lang.String option)
option
- set "r" to read and "w" to write.file
- File namepublic boolean mapNames()
public int getVersion()
public boolean write(java.lang.Object ob)
ob
- Objectpublic int size()
public int getNEntries()
public java.util.ArrayList<jhplot.io.PFile.FileEntry> getEntries()
public java.lang.String entriesToString()
public java.lang.Object read(java.lang.String name)
name
- Name of the objectpublic java.lang.Object read()
public java.lang.String listEntries()
public java.lang.Object read(int index)
index
- of the objectpublic boolean close()
public void doc()
JHepSim. A part of HSTOOLS. version-1.2