Class FileSplit

    • Field Detail

      • rootDir

        protected File rootDir
      • allowFormat

        protected String[] allowFormat
      • recursive

        protected boolean recursive
      • random

        protected Random random
      • randomize

        protected boolean randomize
    • Constructor Detail

      • FileSplit

        protected FileSplit​(File rootDir,
                            String[] allowFormat,
                            boolean recursive,
                            Random random,
                            boolean runMain)
      • FileSplit

        public FileSplit​(File rootDir)
      • FileSplit

        public FileSplit​(File rootDir,
                         Random rng)
      • FileSplit

        public FileSplit​(File rootDir,
                         String[] allowFormat)
      • FileSplit

        public FileSplit​(File rootDir,
                         String[] allowFormat,
                         Random rng)
      • FileSplit

        public FileSplit​(File rootDir,
                         String[] allowFormat,
                         boolean recursive)
    • Method Detail

      • initialize

        protected void initialize()
      • addNewLocation

        public String addNewLocation​(String location)
        Description copied from interface: InputSplit
        Add a new location to this input split (this may do anything from updating an in memory location to creating a new file)
        Specified by:
        addNewLocation in interface InputSplit
        Overrides:
        addNewLocation in class BaseInputSplit
        Parameters:
        location - the location to add
      • updateSplitLocations

        public void updateSplitLocations​(boolean reset)
        Description copied from interface: InputSplit
        Refreshes the split locations if needed in memory. (Think a few file gets added)
      • needsBootstrapForWrite

        public boolean needsBootstrapForWrite()
        Description copied from interface: InputSplit
        Returns true if this InputSplit needs bootstrapping for writing. A simple example of needing bootstrapping is for FileSplit where there is only a directory existing, but no file to write to
        Returns:
        true if this input split needs bootstrapping for writing to or not
      • bootStrapForWrite

        public void bootStrapForWrite()
        Description copied from interface: InputSplit
        Bootstrap this input split for writing. This is for use with RecordWriter
      • openOutputStreamFor

        public OutputStream openOutputStreamFor​(String location)
                                         throws Exception
        Description copied from interface: InputSplit
        Open an OutputStream for the given location. Note that the user is responsible for closing the associated output stream.
        Parameters:
        location - the location to open the output stream for
        Returns:
        the output input stream
        Throws:
        Exception
      • openInputStreamFor

        public InputStream openInputStreamFor​(String location)
                                       throws Exception
        Description copied from interface: InputSplit
        Open an InputStream for the given location. Note that the user is responsible for closing the associated input stream.
        Parameters:
        location - the location to open the input stream for
        Returns:
        the opened input stream
        Throws:
        Exception
      • reset

        public void reset()
        Description copied from interface: InputSplit
        Reset the InputSplit without reinitializing it from scratch. In many cases, this is a no-op. For InputSplits that have randomization: reset should shuffle the order.
      • resetSupported

        public boolean resetSupported()
        Returns:
        True if the reset() method is supported (or is a no-op), false otherwise. If false is returned, reset() may throw an exception
      • getRootDir

        public File getRootDir()