public Object deserialize_sample(
      Object endpoint_data,
      Object dst,
      CdrInputStream src,
      boolean deserialize_encapsulation,
      boolean deserialize_sample,
      Object endpoint_plugin_qos) {
    int position = 0;

    if (deserialize_encapsulation) {
      src.deserializeAndSetCdrEncapsulation();

      position = src.resetAlignment();
    }

    if (deserialize_sample) {

      SunRadiationData typedDst = (SunRadiationData) dst;
      typedDst.clear();
      try {
        typedDst.timestamp = src.readLong();
        typedDst.value = src.readFloat();
      } catch (IllegalCdrStateException stateEx) {
        if (src.available() >= CdrEncapsulation.CDR_ENCAPSULATION_PARAMETER_ID_ALIGNMENT) {
          throw new RETCODE_ERROR(
              "Error deserializing sample! Remainder: "
                  + src.available()
                  + "\n"
                  + "Exception caused by: "
                  + stateEx.getMessage());
        }
      } catch (Exception ex) {
        throw new RETCODE_ERROR(ex.getMessage());
      }
    }
    if (deserialize_encapsulation) {
      src.restoreAlignment(position);
    }

    return dst;
  }