public byte[] readRaw() throws IOException {
    int code = -1;
    try {
      code = in.readUnsignedByte();
    } catch (EOFException eof) {
      return null;
    }
    if (code == Type.BYTES.code) {
      return readRawBytes();
    } else if (code == Type.BYTE.code) {
      return readRawByte();
    } else if (code == Type.BOOL.code) {
      return readRawBool();
    } else if (code == Type.INT.code) {
      return readRawInt();
    } else if (code == Type.LONG.code) {
      return readRawLong();
    } else if (code == Type.FLOAT.code) {
      return readRawFloat();
    } else if (code == Type.DOUBLE.code) {
      return readRawDouble();
    } else if (code == Type.STRING.code) {
      return readRawString();
    } else if (code == Type.MARKER.code) {
      return null;
    } else if (50 <= code && code <= 200) { // application-specific typecodes
      return readRawBytes();
    } else {
      throw new RuntimeException("unknown type");
    }
  }
Reads a typed bytes sequence. The first byte is interpreted as a type code,
and then the right number of subsequent bytes are read depending on the
obtained type.

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