Documentation of 'org.jlab.hipo.io.HipoWriter' Java class
HipoWriter
org.jlab.hipo.io

Class HipoWriter



  • public class HipoWriter
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      HipoWriter() 
      HipoWriter(java.lang.String file)
      creates new Writer with an empty record store and associates with an external file with given name.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addHeader(java.lang.String config)
      Adds string to configuration record, this record will be written the first initiation of write operation.
      void close()
      destructor substitute.
      HipoEvent createEvent()
      Create a new HipoEvent with SchemaFactory of the writer.
      void defineSchema(Schema schema) 
      void defineSchema(java.lang.String name, int group, java.lang.String format) 
      SchemaFactory getSchemaFactory()
      Returns the Schema factory of the writer.
      java.lang.String getStatusString()
      returns a status string containing statistics for all interactions with the writer.
      static void main(java.lang.String[] args)
      Main program to run internal tests and validations.
      void open(java.lang.String name)
      open a file and empty the record store.
      void open(java.lang.String name, byte[] array)
      Opens a file, initializes it with a header.
      void setCompression(boolean flag)
      set compression flag for the writer, if set TRUE all records will be compressed before being written into the file.
      void setCompressionType(int type)
      Sets the compression type for the records.
      void setMaxRecordCount(int maxCount)
      sets maximum allowed events in the record until it's flushed into the stream.
      void setMaxRecordSize(int maxSize)
      sets the maximum buffer size for the records.
      void write()
      Writes the content of the record into the file and resets the record buffer so new data can be added.
      void writeEvent(byte[] event)
      adds an event to the records, not actually written to the disk at this point.
      void writeEvent(HipoEvent event)
      writes a HipoEvent into a record.
      • Methods inherited from class java.lang.Object

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

      • DICTIONARY

        public static int DICTIONARY
      • CUSTOMHEADER

        public static int CUSTOMHEADER
    • Constructor Detail

      • HipoWriter

        public HipoWriter()
      • HipoWriter

        public HipoWriter(java.lang.String file)
        creates new Writer with an empty record store and associates with an external file with given name.
        Parameters:
        file -
    • Method Detail

      • open

        public final void open(java.lang.String name)
        open a file and empty the record store.
        Parameters:
        name - file name to write data in
      • open

        public final void open(java.lang.String name,
                               byte[] array)
        Opens a file, initializes it with a header. and appends provided array to the header. the array content is upto the user, and it can be accessed in the reader once the file is opened for reading.
        Parameters:
        name - name of the file to open.
        array - array to write as a header.
      • addHeader

        public void addHeader(java.lang.String config)
        Adds string to configuration record, this record will be written the first initiation of write operation. It will be record number 0 in the file.
        Parameters:
        config -
      • write

        public void write()
        Writes the content of the record into the file and resets the record buffer so new data can be added.
      • writeEvent

        public void writeEvent(byte[] event)
        adds an event to the records, not actually written to the disk at this point. if the record size or record length exceed the default maximum values the record will be written to the disk and the record container will be reset.
        Parameters:
        event - byte array to add to the events record.
      • writeEvent

        public void writeEvent(HipoEvent event)
        writes a HipoEvent into a record.
        Parameters:
        event - HipoEvent class
      • close

        public void close()
        destructor substitute. it has to be called at the end of program to make sure the incomplete record is flushed to the file, and file stream is properly closed.
      • getStatusString

        public java.lang.String getStatusString()
        returns a status string containing statistics for all interactions with the writer. number of records written, number of bytes written, and the performance statistics.
        Returns:
      • setCompression

        public void setCompression(boolean flag)
        set compression flag for the writer, if set TRUE all records will be compressed before being written into the file.
        Parameters:
        flag -
      • setMaxRecordCount

        public void setMaxRecordCount(int maxCount)
        sets maximum allowed events in the record until it's flushed into the stream.
        Parameters:
        maxCount - maximum number of records.
      • setCompressionType

        public void setCompressionType(int type)
        Sets the compression type for the records. 0 - sets compression flag to false 1 - sets compression algorithm to GZIP 2 - sets compression algorithm to LZ4
        Parameters:
        type -
      • setMaxRecordSize

        public void setMaxRecordSize(int maxSize)
        sets the maximum buffer size for the records. this value is used to check size of the record uncompressed, actual record size written on the disk will be compressed size.
        Parameters:
        maxSize - maximum size in bytes for the record
      • defineSchema

        public void defineSchema(java.lang.String name,
                                 int group,
                                 java.lang.String format)
      • defineSchema

        public void defineSchema(Schema schema)
      • getSchemaFactory

        public SchemaFactory getSchemaFactory()
        Returns the Schema factory of the writer.
        Returns:
      • createEvent

        public HipoEvent createEvent()
        Create a new HipoEvent with SchemaFactory of the writer.
        Returns:
        HipoEvent object with Schema factory
      • main

        public static void main(java.lang.String[] args)
        Main program to run internal tests and validations.
        Parameters:
        args -

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.