001/* 002 * This file is part of Hadoop-Gpl-Compression. 003 * 004 * Hadoop-Gpl-Compression is free software: you can redistribute it and/or 005 * modify it under the terms of the GNU General Public License as published by 006 * the Free Software Foundation, either version 3 of the License, or (at your 007 * option) any later version. 008 * 009 * Hadoop-Gpl-Compression is distributed in the hope that it will be useful, but 010 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 012 * details. 013 * 014 * You should have received a copy of the GNU General Public License along with 015 * Hadoop-Gpl-Compression. If not, see <http://www.gnu.org/licenses/>. 016 */ 017package org.apache.hadoop.io.compress; 018 019import java.io.IOException; 020import java.io.OutputStream; 021import org.apache.commons.logging.Log; 022import org.apache.commons.logging.LogFactory; 023 024/** 025 * This is a bridging class whose sole purpose is to provide backward 026 * compatibility of applications that historically depend on 027 * {@link org.apache.hadoop.io.compress.LzoCodec} (such as SequenceFile). 028 * 029 * The class is marked as @deprecated and should not be used explicitly in the 030 * future. 031 * 032 * A warning message will be generated when a user wants to use this class to 033 * generate LZO compressed data. Not the case for decompression because this is 034 * the legitimate backward compatibility usage. 035 */ 036@Deprecated 037public class LzoCodec extends com.hadoop.compression.lzo.LzoCodec { 038 039 private static final Log LOG = LogFactory.getLog(LzoCodec.class); 040 041 static final String oahLzoCodec = LzoCodec.class.getName(); 042 static final String chclLzoCodec 043 = com.hadoop.compression.lzo.LzoCodec.class.getName(); 044 private static boolean warned = false; 045 046 static { 047 LOG.info("Bridging " + oahLzoCodec + " to " + chclLzoCodec + "."); 048 } 049 050 @Override 051 public CompressionOutputStream createOutputStream(OutputStream out, 052 Compressor compressor) throws IOException { 053 if (!warned) { 054 LOG.warn(oahLzoCodec + " is deprecated. You should use " + chclLzoCodec 055 + " instead to generate LZO compressed data."); 056 warned = true; 057 } 058 return super.createOutputStream(out, compressor); 059 } 060}