public int deserialize()

in src/main/java/com/amazonaws/encryptionsdk/model/CipherFrameHeaders.java [184:220]


  public int deserialize(final byte[] b, final int off) {
    if (b == null) {
      return 0;
    }

    int parsedBytes = 0;
    try {
      if (sequenceNumber_ == 0) {
        parsedBytes += parseSequenceNumber(b, off + parsedBytes);
      }

      // parse the sequence number again if the sequence number parsed in
      // the previous call is the final frame marker and this frame hasn't
      // already been marked final.
      if (sequenceNumber_ == Constants.ENDFRAME_SEQUENCE_NUMBER && !isFinalFrame_) {
        parsedBytes += parseSequenceNumber(b, off + parsedBytes);
        isFinalFrame_ = true;
      }

      if (nonceLength_ > 0 && nonce_ == null) {
        parsedBytes += parseNonce(b, off + parsedBytes);
      }

      if (includeFrameSize_ || isFinalFrame_) {
        if (frameContentLength_ < 0) {
          parsedBytes += parseFrameContentLength(b, off + parsedBytes);
        }
      }

      isComplete_ = true;
    } catch (ParseException e) {
      // this results when we do partial parsing and there aren't enough
      // bytes to parse; so just return the bytes parsed thus far.
    }

    return parsedBytes;
  }