Writable接口:
包名:org.apache.hadoop.io
方法:write(DataOutput var1) 用于序列化对象
方法:readFields(DataInput var1) 用于反序列化对象
Comparable接口:
包名:java.lang
方法:compareTo(T o) 用于比较大小,排序可能会调用
WritableComparable 接口:
继承: extends Writable, Comparable
包名:org.apache.hadoop.io
方法:write(DataOutput var1)
readFields(DataInput var1)
compareTo(T o)
Writable基础数据类:
实现的接口:WritableComparable
例如:BolleanWritable\ByteWritable\ShortWritable\IntWritable\Text等
Writable集合类:
实现的接口: 大部分不实现WritableComparable接口,实现Writable接口以及继承相应数据结构的类
包含:ArrayWritable,ArrayPrimitiveWritable,TwoDArrayWritable,MapWritable,SortedMapWritable
自定义Writable类,需要实现WritableComparable 接口,并重写以下方法:
write() readFields() compareTo()
hashCode() equals() toString()