Enum value implementing Writable interface of Hadoop

前端 未结 3 597
孤独总比滥情好
孤独总比滥情好 2021-01-19 03:17

Suppose I have an enumeration:

public enum SomeEnumType implements Writable {
  A(0), B(1);

  private int value;

  private SomeEnumType(int value) {
    th         


        
3条回答
  •  一向
    一向 (楼主)
    2021-01-19 04:05

    WritableUtils has convenience methods that make this easier.

    WritableUtils.writeEnum(dataOutput,enumData);
    enumData = WritableUtils.readEnum(dataInput,MyEnum.class);
    

提交回复
热议问题