org.apache.hadoop.mapred
Class MultiFileSplit

java.lang.Object
  extended by org.apache.hadoop.mapred.MultiFileSplit
All Implemented Interfaces:
Writable, InputSplit

public class MultiFileSplit
extends Object
implements InputSplit

A sub-collection of input files. Unlike FileSplit, MultiFileSplit class does not represent a split of a file, but a split of input files into smaller sets. The atomic unit of split is a file.
MultiFileSplit can be used to implement RecordReader's, with reading one record per file.

See Also:
FileSplit, MultiFileInputFormat

Constructor Summary
MultiFileSplit(JobConf job, Path[] files, long[] lengths)
           
 
Method Summary
 long getLength()
          Get the number of input bytes in the split.
 long getLength(int i)
          Returns the length of the ith Path
 long[] getLengths()
          Returns an array containing the lengths of the files in the split
 String[] getLocations()
          Get the list of hostnames where the input split is located.
 int getNumPaths()
          Returns the number of Paths in the split
 Path getPath(int i)
          Returns the ith Path
 Path[] getPaths()
          Returns all the Paths in the split
 void readFields(DataInput in)
          Reads the fields of this object from in.
 void write(DataOutput out)
          Writes the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiFileSplit

public MultiFileSplit(JobConf job,
                      Path[] files,
                      long[] lengths)
Method Detail

getLength

public long getLength()
Description copied from interface: InputSplit
Get the number of input bytes in the split.

Specified by:
getLength in interface InputSplit
Returns:
the number of bytes in the input split

getLengths

public long[] getLengths()
Returns an array containing the lengths of the files in the split


getLength

public long getLength(int i)
Returns the length of the ith Path


getNumPaths

public int getNumPaths()
Returns the number of Paths in the split


getPath

public Path getPath(int i)
Returns the ith Path


getPaths

public Path[] getPaths()
Returns all the Paths in the split


getLocations

public String[] getLocations()
                      throws IOException
Description copied from interface: InputSplit
Get the list of hostnames where the input split is located.

Specified by:
getLocations in interface InputSplit
Returns:
A list of prefered hostnames
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Description copied from interface: Writable
Reads the fields of this object from in. For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Description copied from interface: Writable
Writes the fields of this object to out.

Specified by:
write in interface Writable
Throws:
IOException


Copyright © 2006 The Apache Software Foundation