Class FileOutputFormat<IT>

    • Field Detail

      • outputFilePath

        protected Path outputFilePath
        The path of the file to be written.
      • stream

        protected transient FSDataOutputStream stream
        The stream to which the data is written;
    • Constructor Detail

      • FileOutputFormat

        public FileOutputFormat()
      • FileOutputFormat

        public FileOutputFormat​(Path outputPath)
    • Method Detail

      • initDefaultsFromConfiguration

        public static void initDefaultsFromConfiguration​(Configuration configuration)
        Initialize defaults for output format. Needs to be a static method because it is configured for local cluster execution.
        Parameters:
        configuration - The configuration to load defaults from
      • setOutputFilePath

        public void setOutputFilePath​(Path path)
      • getOutputFilePath

        public Path getOutputFilePath()
      • configure

        public void configure​(Configuration parameters)
        Description copied from interface: OutputFormat
        Configures this output format. Since output formats are instantiated generically and hence parameterless, this method is the place where the output formats set their basic fields based on configuration values.

        This method is always called first on a newly instantiated output format.

        Specified by:
        configure in interface OutputFormat<IT>
        Parameters:
        parameters - The configuration with all parameters.
      • open

        public void open​(OutputFormat.InitializationContext context)
                  throws IOException
        Description copied from interface: OutputFormat
        Opens a parallel instance of the output format to store the result of its parallel instance.

        When this method is called, the output format it guaranteed to be configured.

        Specified by:
        open in interface OutputFormat<IT>
        Parameters:
        context - The context to get task parallel infos.
        Throws:
        IOException - Thrown, if the output could not be opened due to an I/O problem.
      • getDirectoryFileName

        protected String getDirectoryFileName​(int taskNumber)
      • close

        public void close()
                   throws IOException
        Description copied from interface: OutputFormat
        Method that marks the end of the life-cycle of parallel output instance. Should be used to close channels and streams and release resources. After this method returns without an error, the output is assumed to be correct.

        When this method is called, the output format it guaranteed to be opened.

        Specified by:
        close in interface OutputFormat<IT>
        Throws:
        IOException - Thrown, if the input could not be closed properly.
      • initializeGlobal

        public void initializeGlobal​(int parallelism)
                              throws IOException
        Initialization of the distributed file system if it is used.
        Specified by:
        initializeGlobal in interface InitializeOnMaster
        Parameters:
        parallelism - The task parallelism.
        Throws:
        IOException - The initialization may throw exceptions, which may cause the job to abort.