code: public static Writer
      createWriter(FileSystem fs, Configuration conf, Path name,
                   Class keyClass, Class valClass, int bufferSize,
                   short replication, long blockSize,
                   CompressionType compressionType, CompressionCodec codec,
                   Progressable progress, Metadata metadata) throws IOException {
      if ((codec instanceof GzipCodec) &&
          !NativeCodeLoader.isNativeCodeLoaded() &&
          !ZlibFactory.isNativeZlibLoaded(conf)) {
        throw new IllegalArgumentException("SequenceFile doesn't work with " +
                                           "GzipCodec without native-hadoop code!");
      }
  
      Writer writer = null;
  
      if (compressionType == CompressionType.NONE) {
        writer = new Writer(fs, conf, name, keyClass, valClass,
                            bufferSize, replication, blockSize,
                            progress, metadata);
      } else if (compressionType == CompressionType.RECORD) {
        writer = new RecordCompressWriter(fs, conf, name, keyClass, valClass,
                                          bufferSize, replication, blockSize,
                                          codec, progress, metadata);
      } else if (compressionType == CompressionType.BLOCK){
        writer = new BlockCompressWriter(fs, conf, name, keyClass, valClass,
                                         bufferSize, replication, blockSize,
                                         codec, progress, metadata);
      }
  
      return writer;
    }
docs: Construct the preferred type of SequenceFile Writer.
  @param fs The configured filesystem.
  @param conf The configuration.
  @param name The name of the file.
  @param keyClass The 'key' type.
  @param valClass The 'value' type.
  @param bufferSize buffer size for the underlaying outputstream.
  @param replication replication factor for the file.
  @param blockSize block size for the file.
  @param compressionType The compression type.
  @param codec The compression codec.
  @param progress The Progressable object to track progress.
  @param metadata The metadata of the file.
  @return Returns the handle to the constructed SequenceFile Writer.
  @throws IOException