Package org.apache.avro.hadoop.io

# Class AvroDatumConverterFactory

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.avro.hadoop.io.AvroDatumConverterFactory

All Implemented Interfaces:
  `Configurable`

public class AvroDatumConverterFactory extends Configured
Constructs converters that turn objects (usually from the output of a MR job) into Avro data that can be serialized.

Currently, only the following types have implemented converters:

- AvroKey
- AvroValue
- BooleanWritable
- BytesWritable
- ByteWritable
- DoubleWritable
- FloatWritable
- IntWritable
- LongWritable
- NullWritable
- Text

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`AvroDatumConverterFactory.AvroWrapperConverter`
Converts AvroWrappers into their wrapped Avro data.
`static class`
`AvroDatumConverterFactory.BooleanWritableConverter`
Converts BooleanWritables into Booleans.
`static class`
`AvroDatumConverterFactory.BytesWritableConverter`
Converts BytesWritables into ByteBuffers.
`static class`
`AvroDatumConverterFactory.ByteWritableConverter`
Converts ByteWritables into GenericFixed of size 1.
`static class`
`AvroDatumConverterFactory.DoubleWritableConverter`
Converts DoubleWritables into Doubles.
`static class`
`AvroDatumConverterFactory.FloatWritableConverter`
Converts FloatWritables into Floats.
`static class`
`AvroDatumConverterFactory.IntWritableConverter`
Converts IntWritables into Ints.
`static class`
`AvroDatumConverterFactory.LongWritableConverter`
Converts LongWritables into Longs.
`static class`
`AvroDatumConverterFactory.NullWritableConverter`
Converts NullWritables into Nulls.
`static class`
`AvroDatumConverterFactory.TextConverter`
Converts Text into CharSequences.

## Constructor Summary

Constructors
Constructor
Description
`AvroDatumConverterFactory(Configuration conf)`
Creates a new `AvroDatumConverterFactory` instance.

## Method Summary

Modifier and Type
Method
Description
`<IN, OUT> AvroDatumConverter<IN,OUT>`
`create(Class<IN> inputClass)`
Creates a converter that turns objects of type `inputClass` into Avro data.

### Methods inherited from class org.apache.hadoop.conf.Configured

`getConf, setConf`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AvroDatumConverterFactory

public AvroDatumConverterFactory(Configuration conf)
Creates a new `AvroDatumConverterFactory` instance.

Parameters:
  `conf` - The job configuration.

## Method Details

### create

public <IN, OUT> AvroDatumConverter<IN,OUT> create(Class<IN> inputClass)
Creates a converter that turns objects of type `inputClass` into Avro data.

Parameters:
  `inputClass` - The type of input data to convert.
Returns:
  A converter that turns objects of type `inputClass` into Avro data.