code: public static <T> T readVersionAndDeSerialize(SimpleVersionedSerializer<T> serializer, byte[] bytes) throws IOException {
  		checkNotNull(serializer, "serializer");
  		checkNotNull(bytes, "bytes");
  		checkArgument(bytes.length >= 4, "byte array below minimum length (4 bytes)");
  
  		final byte[] dataOnly = Arrays.copyOfRange(bytes, 8, bytes.length);
  		final int version =
  				((bytes[0] & 0xff) << 24) |
  				((bytes[1] & 0xff) << 16) |
  				((bytes[2] & 0xff) <<  8) |
  				(bytes[3] & 0xff);
  
  		final int length =
  				((bytes[4] & 0xff) << 24) |
  				((bytes[5] & 0xff) << 16) |
  				((bytes[6] & 0xff) <<  8) |
  				(bytes[7] & 0xff);
  
  		if (length == dataOnly.length) {
  			return serializer.deserialize(version, dataOnly);
  		}
  		else {
  			throw new IOException("Corrupt data, conflicting lengths. Length fields: " + length + ", data: " + dataOnly.length);
  		}
  	}
docs: Deserializes the version and datum from a byte array. The first four bytes will be read as
  the version, in <i>big-endian</i> encoding. The remaining bytes will be passed to the serializer
  for deserialization, via {@link SimpleVersionedSerializer#deserialize(int, byte[])}.
  
  @param serializer The serializer to deserialize the datum with.
  @param bytes The bytes to deserialize from.
  
  @return The deserialized datum.
  
  @throws IOException Exceptions from the {@link SimpleVersionedSerializer#deserialize(int, byte[])}
  method are forwarded.