Add support for writing compressed text.

Change-Id: I314b925594801ae4b5c47248d998801aa0b37270
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4169
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>