public Type readType() throws IOException {
    int code = -1;
    try {
      code = in.readUnsignedByte();
    } catch (EOFException eof) {
      return null;
    }
    for (Type type : Type.values()) {
      if (type.code == code) {
        return type;
      }
    }
    return null;
  }
Reads a type byte and returns the corresponding {@link Type}.

@return the obtained Type or null when the end of the file is reached
@throws IOException
contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesInput.java