HADOOP-9996 extends TFile to support any compression codecs available in Hadoop, such as Snappy. This also provides the opportunity to utilize the crypto codec for encryption, a new feature added by HADOOP-9331. The crypto codec is based on the compression codec and it is a natural extension of its usage here. While in API level encryption usually needs a key context while compression usually doesn’t.
This work needs to extend the TFile Reader and Writer to passing and handling a context of the codec. For crypto codecs, this may be the key information for using to encrypt or decrypt the data. To keep the backward compatibility of the reader and writer, new methods or constructor with codec context can be added instead of modifying the existing methods.