org.apache.hadoop.mapred
Class TextInputFormat

java.lang.Object
  extended by org.apache.hadoop.mapred.InputFormatBase
      extended by org.apache.hadoop.mapred.TextInputFormat
All Implemented Interfaces:
InputFormat, JobConfigurable

public class TextInputFormat
extends InputFormatBase
implements JobConfigurable

An InputFormat for plain text files. Files are broken into lines. Either linefeed or carriage-return are used to signal end of line. Keys are the position in the file, and values are the line of text..


Nested Class Summary
protected static class TextInputFormat.LineRecordReader
           
 
Field Summary
 
Fields inherited from class org.apache.hadoop.mapred.InputFormatBase
LOG
 
Constructor Summary
TextInputFormat()
           
 
Method Summary
 void configure(JobConf conf)
          Initializes a new instance from a JobConf.
 RecordReader getRecordReader(FileSystem fs, FileSplit split, JobConf job, Reporter reporter)
          Construct a RecordReader for a FileSplit.
protected  boolean isSplitable(FileSystem fs, Path file)
          Is the given filename splitable? Usually, true, but if the file is stream compressed, it will not be.
static long readLine(InputStream in, OutputStream out)
           
 
Methods inherited from class org.apache.hadoop.mapred.InputFormatBase
areValidInputDirectories, getSplits, listFiles, listPaths, setMinSplitSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextInputFormat

public TextInputFormat()
Method Detail

configure

public void configure(JobConf conf)
Description copied from interface: JobConfigurable
Initializes a new instance from a JobConf.

Specified by:
configure in interface JobConfigurable
Parameters:
conf - the configuration

isSplitable

protected boolean isSplitable(FileSystem fs,
                              Path file)
Description copied from class: InputFormatBase
Is the given filename splitable? Usually, true, but if the file is stream compressed, it will not be.

Overrides:
isSplitable in class InputFormatBase
Parameters:
fs - the file system that the file is on
file - the file name to check
Returns:
is this file splitable?

getRecordReader

public RecordReader getRecordReader(FileSystem fs,
                                    FileSplit split,
                                    JobConf job,
                                    Reporter reporter)
                             throws IOException
Description copied from interface: InputFormat
Construct a RecordReader for a FileSplit.

Specified by:
getRecordReader in interface InputFormat
Specified by:
getRecordReader in class InputFormatBase
Parameters:
fs - the FileSystem
split - the FileSplit
job - the job that this split belongs to
Returns:
a RecordReader
Throws:
IOException

readLine

public static long readLine(InputStream in,
                            OutputStream out)
                     throws IOException
Throws:
IOException


Copyright © 2006 The Apache Software Foundation