IFileInputStream checksumIn = new IFileInputStream(input, compressedLength,
ifileReadAhead, ifileReadAheadLength);
input = checksumIn;
Decompressor decompressor = null;
// Are map-outputs compressed?
if (codec != null) {
decompressor = CodecPool.getDecompressor(codec);
decompressor.reset();
input = codec.createInputStream(input, decompressor);
}
// Copy map-output into an in-memory buffer
byte[] shuffleData = fetchedInput.getBytes();
try {
IOUtils.readFully(input, shuffleData, 0, shuffleData.length);
// metrics.inputBytes(shuffleData.length);
LOG.info("Read " + shuffleData.length + " bytes from input for "
+ fetchedInput.getInputAttemptIdentifier());
} catch (IOException ioe) {
// Close the streams
IOUtils.cleanup(LOG, input);
// Re-throw
throw ioe;
} finally {
if(decompressor != null) {
decompressor.reset();
CodecPool.returnDecompressor(decompressor);
}
}
}