public Type getType() {
    byte[] bytes = getBytes();
    if (bytes == null || bytes.length == 0) {
      return null;
    }
    for (Type type : Type.values()) {
      if (type.code == bytes[0]) {
        return type;
      }
    }
    return null;
  }
Get the type code embedded in the first byte.
contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesWritable.java