Class FileProcessor<T extends Event>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BATCH_SIZE  
    • Constructor Summary

      Constructors 
      Constructor Description
      FileProcessor​(org.openstreetmap.atlas.generator.tools.spark.utilities.SparkFileHelper fileHelper, java.lang.String directory)
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean doesCompressOutput()  
      int getBatchSize()  
      int getCount()  
      protected java.lang.String getFilename()  
      void process​(java.lang.String event)
      Processes given String and writes batched events into a file if needed
      void setBatchSize​(int batchSize)
      Sets batch size to given value
      FileProcessor<T> withCompression​(boolean compress)
      Sets whether or not output files are compressed
      protected void write()
      Writes a new file with the cached in String buffer
      • Methods inherited from class java.lang.Object

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

      • FileProcessor

        public FileProcessor​(org.openstreetmap.atlas.generator.tools.spark.utilities.SparkFileHelper fileHelper,
                             java.lang.String directory)
        Default constructor
        Parameters:
        fileHelper - SparkFileHelper instance for I/O operations
        directory - directory path to write files to
    • Method Detail

      • doesCompressOutput

        public boolean doesCompressOutput()
      • getBatchSize

        public int getBatchSize()
        Returns:
        the maximum number of events to be batched in a file
      • getCount

        public final int getCount()
        Returns:
        the number of events processed in the current batch
      • process

        public void process​(java.lang.String event)
        Processes given String and writes batched events into a file if needed
        Parameters:
        event - a character set to process
      • setBatchSize

        public void setBatchSize​(int batchSize)
        Sets batch size to given value
        Parameters:
        batchSize - New batch size
      • withCompression

        public FileProcessor<T> withCompression​(boolean compress)
        Sets whether or not output files are compressed
        Parameters:
        compress - value to set
        Returns:
        the FileProcessor
      • getFilename

        protected java.lang.String getFilename()
        Returns:
        the name of the file to be used in #write() method to write files
      • write

        protected void write()
        Writes a new file with the cached in String buffer