IN
- The type of element to write.@PublicEvolving public class CompressWriterFactory<IN> extends Object implements BulkWriter.Factory<IN>
bulk writers
that, when provided
with a CompressionCodec
, they compress the data they write. If no codec is
provided, the data is written in bulk but uncompressed.Constructor and Description |
---|
CompressWriterFactory(Extractor<IN> extractor)
Creates a new CompressWriterFactory using the given
Extractor to assemble
either HadoopCompressionBulkWriter or NoCompressionBulkWriter
based on whether a Hadoop CompressionCodec name is specified. |
Modifier and Type | Method and Description |
---|---|
BulkWriter<IN> |
create(FSDataOutputStream out)
Creates a writer that writes to the given stream.
|
String |
getExtension() |
CompressWriterFactory<IN> |
withHadoopCompression(String codecName)
Compresses the data using the provided Hadoop
CompressionCodec . |
CompressWriterFactory<IN> |
withHadoopCompression(String codecName,
Configuration hadoopConfig)
Compresses the data using the provided Hadoop
CompressionCodec and Configuration . |
public CompressWriterFactory(Extractor<IN> extractor)
Extractor
to assemble
either HadoopCompressionBulkWriter
or NoCompressionBulkWriter
based on whether a Hadoop CompressionCodec name is specified.extractor
- Extractor to extract the elementpublic CompressWriterFactory<IN> withHadoopCompression(String codecName) throws IOException
CompressionCodec
.codecName
- Simple/complete name or alias of the CompressionCodecIOException
public CompressWriterFactory<IN> withHadoopCompression(String codecName, Configuration hadoopConfig) throws IOException
CompressionCodec
and Configuration
.codecName
- Simple/complete name or alias of the CompressionCodechadoopConfig
- Hadoop ConfigurationIOException
public BulkWriter<IN> create(FSDataOutputStream out) throws IOException
BulkWriter.Factory
create
in interface BulkWriter.Factory<IN>
out
- The output stream to write the encoded data to.IOException
- Thrown if the writer cannot be opened, or if the output
stream throws an exception.public String getExtension()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.