|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjhplot.io.PFile
public class PFile
Write or read objects in sequential order using Google's Prototype Buffer scheme. Each record inside files is compressed on-fly. The file size are smaller than when using HFile class. All graphical attributes are lost (use HFile class for this). You can unzip the file to see its structure. Normally, files should extension "pbu". Files can be viewed using PFileBrowser. Unlike the usual XML, the file size is small. At this moment, the following objects are supported: a string,P0I, P0D, P1D, PND, PNI, F1D,F2D, FND,PRN, H1D, H2D. A protocol Buffers file is provided which can be used for C++ input. This I/O is mainly for "named" objects (which implement the method setTitle() or setName(). Use CBook package to create such files in C++.
Use this approach for storing P0D, P0I, P1D, H1D, H2D, F1D, F2D objects.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
boolean |
close()
Close the file |
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 |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 nameMethod Detail |
---|
public boolean mapNames()
public int getVersion()
public boolean write(java.lang.Object ob)
ob
- Objectkey
- key for object
public 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 object
public java.lang.Object read()
public java.lang.String listEntries()
public java.lang.Object read(int index)
index
- of the object
public boolean close()
|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |