Documentation of 'jhplot.io.EFile' Java class.
EFile
jhplot.io

Class EFile



  • public class EFile
    extends java.lang.Object
    Write 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 Summary

      Constructors 
      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 Summary

      All Methods Instance Methods Concrete Methods 
      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.
      int getNEntries()
      Get number of events stored in the file.
      int getVersion()
      Get version of the input file.
      promc.io.PEventFile.HEvent read()
      Read next event
      promc.io.PEventFile.HEvent read(int index)
      Get object from a file using its index.
      int size()
      Get the number of events stored in the file.
      boolean write(promc.io.PEventFile.HEvent.Builder ev)
      Add a data structure to a file
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EFile

        public 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.
      • EFile

        public EFile(java.lang.String file)
        Open file for reading objects from a serialized file in sequential order.
        Parameters:
        file - File name
    • Method Detail

      • getVersion

        public 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.
      • write

        public 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
      • size

        public int size()
        Get the number of events stored in the file.
        Returns:
        number of stored objects
      • getNEntries

        public int getNEntries()
        Get number of events stored in the file. Same as size()
        Returns:
        number of stored objects
      • entriesToString

        public java.lang.String entriesToString()
        Get a string representing file content.
        Returns:
        File content.
      • read

        public promc.io.PEventFile.HEvent read()
        Read next event
        Returns:
        next object.
      • read

        public 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)
      • close

        public boolean close()
        Close the file
        Returns:
      • doc

        public void doc()
        Show online documentation.

DMelt 3.0 © DataMelt by jWork.ORG