Database Reference
In-Depth Information
InterruptedException {
if (! processed ) {
byte [] contents = new byte [( int ) fileSplit . getLength ()];
Path file = fileSplit . getPath ();
FileSystem fs = file . getFileSystem ( conf );
FSDataInputStream in = null ;
try {
in = fs . open ( file );
IOUtils . readFully ( in , contents , 0 , contents . length );
value . set ( contents , 0 , contents . length );
} finally {
IOUtils . closeStream ( in );
}
processed = true ;
return true ;
}
return false ;
}
@Override
public NullWritable getCurrentKey () throws IOException ,
InterruptedException {
return NullWritable . get ();
}
@Override
public BytesWritable getCurrentValue () throws IOException ,
InterruptedException {
return value ;
}
@Override
public float getProgress () throws IOException {
return processed ? 1.0f : 0.0f ;
}
@Override
public void close () throws IOException {
// do nothing
}
}
WholeFileRecordReader is responsible for taking a FileSplit and converting it
into a single record, with a null key and a value containing the bytes of the file. Because
there is only a single record, WholeFileRecordReader has either processed it or not,
Search WWH ::




Custom Search