private static DeserializedKey deserializeKey(InputStream stream) throws IOException, MessageFormatException {
    DataInputStream inputStream = new DataInputStream(stream);
    short version = inputStream.readShort();
    switch (version) {
      case KEY_RECORD_VERSION_V_1:
        return KeyRecord_Format_V1.deserializeKeyRecord(inputStream);
      default:
        throw new MessageFormatException("KeyRecord version not supported",
            MessageFormatErrorCodes.UnknownFormatVersion);
    }
  }
Deserialize key from the stream
@param stream the {@link InputStream} from which key needs to be deserialized
@return the deserialized key in the form of {@link DeserializedKey}
@throws IOException
@throws MessageFormatException
ambry-router/src/main/java/com/github/ambry/router/GCMCryptoService.java