jhplot.io
Class EFile
- java.lang.Object
- 
- jhplot.io.EFile
 
- 
 
 public class EFile extends java.lang.ObjectWrite data structures in sequential order into ntuples using Google's Prototype Buffer. The same class can be used to read data from ntuples. Each data record inside files is compressed on-fly using zip. Normally, files should extension "nbu" (ntuples). A protocol Buffers file is provided which can be used for C++ input. Use the CBook package to create such files in C++.
- 
- 
Constructor SummaryConstructors Constructor and Description EFile(java.lang.String file)Open file for reading objects from a serialized file in sequential order.EFile(java.lang.String file, java.lang.String option)Open a file to write/read objects to/from a file in sequential order.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanclose()Close the filevoiddoc()Show online documentation.java.lang.StringentriesToString()Get a string representing file content.intgetNEntries()Get number of events stored in the file.intgetVersion()Get version of the input file.promc.io.PEventFile.HEventread()Read next eventpromc.io.PEventFile.HEventread(int index)Get object from a file using its index.intsize()Get the number of events stored in the file.booleanwrite(promc.io.PEventFile.HEvent.Builder ev)Add a data structure to a file
 
- 
- 
- 
Constructor Detail- 
EFilepublic EFile(java.lang.String file, java.lang.String option)Open a file to write/read objects to/from a file in sequential order. If "w" option is set, the old file will be removed. Use close() to flash the buffer and close the file.- Parameters:
- file- File name
- option- Option to create the file. If "w" - write a file (or read) file, if "r" only read created file.
 
 - 
EFilepublic EFile(java.lang.String file) Open file for reading objects from a serialized file in sequential order.- Parameters:
- file- File name
 
 
- 
 - 
Method Detail- 
getVersionpublic int getVersion() Get version of the input file. The version is an integer written as an additional entry in the file "version". Check this by unzipping the file.- Returns:
- version of the created file.
 
 - 
writepublic boolean write(promc.io.PEventFile.HEvent.Builder ev) Add a data structure to a file- Parameters:
- ev- Data in form HEvent class.
- Returns:
- true if success
 
 - 
sizepublic int size() Get the number of events stored in the file.- Returns:
- number of stored objects
 
 - 
getNEntriespublic int getNEntries() Get number of events stored in the file. Same as size()- Returns:
- number of stored objects
 
 - 
entriesToStringpublic java.lang.String entriesToString() Get a string representing file content.- Returns:
- File content.
 
 - 
readpublic promc.io.PEventFile.HEvent read() Read next event- Returns:
- next object.
 
 - 
readpublic promc.io.PEventFile.HEvent read(int index) Get object from a file using its index.- Parameters:
- index- of the object
- Returns:
- Object extracted object (or null)
 
 - 
closepublic boolean close() Close the file- Returns:
 
 - 
docpublic void doc() Show online documentation.
 
- 
 
- 
DMelt 3.0 © DataMelt by jWork.ORG