EFile
jhplot.io

Class EFile



  • public class EFileextends 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(String file)
      Open file for reading objects from a serialized file in sequential order.
      EFile(String file, String option)
      Open a file to write/read objects to/from a file in sequential order.
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      booleanclose()
      Close the file
      voiddoc()
      Show online documentation.
      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 event
      promc.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

      • EFile

        public EFile(String file,     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(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 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.

SCaVis 1.8 © jWork.org