boolean isCompressed = IFile.Reader.isCompressedFlagEnabled(in);
IFileInputStream checksumIn = new IFileInputStream(in,
compressedLength - IFile.HEADER.length, ifileReadAhead,
ifileReadAheadLength);
in = checksumIn;
Decompressor decompressor = null;
if (isCompressed && codec != null) {
decompressor = CodecPool.getDecompressor(codec);
if (decompressor != null) {
decompressor.reset();
in = codec.createInputStream(checksumIn, decompressor);
} else {
LOG.warn("Could not obtain decompressor from CodecPool");
in = checksumIn;
}
}
try {
IOUtils.readFully(in, buffer, 0, buffer.length - IFile.HEADER.length);
} catch (IOException ioe) {
IOUtils.cleanup(LOG, in);
throw ioe;
} finally {
if (decompressor != null) {
decompressor.reset();
CodecPool.returnDecompressor(decompressor);
}
}
}