public Class<? extends Writable> readType() throws IOException {
   Type type = in.readType();
   if (type == null) {
     return null;
   }
   switch (type) {
     case BYTES:
       return BytesWritable.class;
     case BYTE:
       return ByteWritable.class;
     case BOOL:
       return BooleanWritable.class;
     case INT:
       return VIntWritable.class;
     case LONG:
       return VLongWritable.class;
     case FLOAT:
       return FloatWritable.class;
     case SHORT:
       return ShortWritable.class;
     case DOUBLE:
       return DoubleWritable.class;
     case STRING:
       return Text.class;
     case VECTOR:
       return ArrayWritable.class;
     case MAP:
       return MapWritable.class;
     case WRITABLE:
       return Writable.class;
     case ENDOFRECORD:
       return null;
     case NULL:
       return NullWritable.class;
     default:
       throw new RuntimeException("unknown type");
   }
 }
 public Writable read() throws IOException {
   Type type = in.readType();
   if (type == null) {
     return null;
   }
   switch (type) {
     case BYTES:
       return readBytes();
     case BYTE:
       return readByte();
     case BOOL:
       return readBoolean();
     case INT:
       return readVInt();
     case SHORT:
       return readShort();
     case LONG:
       return readVLong();
     case FLOAT:
       return readFloat();
     case DOUBLE:
       return readDouble();
     case STRING:
       return readText();
     case VECTOR:
       return readArray();
     case MAP:
       return readMap();
     case WRITABLE:
       return readWritable();
     case ENDOFRECORD:
       return null;
     case NULL:
       return NullWritable.get();
     default:
       throw new RuntimeException("unknown type");
   }
 }
 public Type readTypeCode() throws IOException {
   return in.readType();
 }