org.apache.hadoop.mapred
Class FileSplit

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

public class FileSplit
extends Object
implements InputSplit

A section of an input file. Returned by InputFormat.getSplits(JobConf, int) and passed to InputFormat.getRecordReader(InputSplit,JobConf,Reporter).


Constructor Summary
FileSplit(Path file, long start, long length, JobConf conf)
          Constructs a split.
 
Method Summary
 File getFile()
          Deprecated. Call getPath() instead.
 long getLength()
          The number of bytes in the file to process.
 String[] getLocations()
          Get the list of hostnames where the input split is located.
 Path getPath()
          The file containing this split's data.
 long getStart()
          The position of the first byte in the file to process.
 void readFields(DataInput in)
          Reads the fields of this object from in.
 String toString()
           
 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, wait, wait, wait
 

Constructor Detail

FileSplit

public FileSplit(Path file,
                 long start,
                 long length,
                 JobConf conf)
Constructs a split.

Parameters:
file - the file name
start - the position of the first byte in the file to process
length - the number of bytes in the file to process
Method Detail

getFile

public File getFile()
Deprecated. Call getPath() instead.


getPath

public Path getPath()
The file containing this split's data.


getStart

public long getStart()
The position of the first byte in the file to process.


getLength

public long getLength()
The number of bytes in the file to process.

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

toString

public String toString()
Overrides:
toString in class Object

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

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

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


Copyright © 2006 The Apache Software Foundation