public Object decode(CachedData d) {
    byte[] data = d.getData();
    Object rv = null;
    if ((d.getFlags() & COMPRESSED) != 0) {
      data = decompress(d.getData());
    }
    if ((d.getFlags() & SERIALIZED) != 0) {
      rv = deserialize(data);
    } else {
      int f = data[0];
      switch (f) {
      case SPECIAL_BOOLEAN:
        rv = decodeBoolean(data);
        break;
      case SPECIAL_INTEGER:
        rv = decodeInteger(data);
        break;
      case SPECIAL_SHORT:
        rv = decodeShort(data);
        break;
      case SPECIAL_LONG:
        rv = decodeLong(data);
        break;
      case SPECIAL_DATE:
        rv = new Date(decodeLong(data));
        break;
      case SPECIAL_BYTE:
        rv = decodeByte(data);
        break;
      case SPECIAL_FLOAT:
        rv = decodeFloat(data);
        break;
      case SPECIAL_DOUBLE:
        rv = decodeDouble(data);
        break;
      case SPECIAL_STRING:
        rv = decodeW1String(data);
        break;
      case SPECIAL_STRINGBUFFER:
        rv = new StringBuffer(decodeW1String(data));
        break;
      case SPECIAL_STRINGBUILDER:
        rv = new StringBuilder(decodeW1String(data));
        break;
      case SPECIAL_CHARACTER:
        rv = decodeCharacter(data);
        break;
      default:
        getLogger().warn("Cannot handle data with flags %x", f);
      }
    }
    return rv;
  }
Handles old whalin (tested with v1.6) encoding: data type is in the first
byte of the value.

@author bpartensky
@since Oct 16, 2008
src/main/java/net/spy/memcached/transcoders/WhalinV1Transcoder.java