Exemplo n.º 1
0
        /// <summary>
        /// Return an initialised default Data Frame Header.
        /// </summary>
        /// <param name="sessionId"> for the header </param>
        /// <param name="streamId">  for the header </param>
        /// <param name="termId">    for the header </param>
        /// <returns> byte array containing the header </returns>
	    public static UnsafeBuffer CreateDefaultHeader(int sessionId, int streamId, int termId)
        {
            var buffer = new UnsafeBuffer(new byte[HEADER_LENGTH]);

            buffer.PutByte(VERSION_FIELD_OFFSET, CURRENT_VERSION);
            buffer.PutByte(FLAGS_FIELD_OFFSET, (byte)BEGIN_AND_END_FLAGS);
            buffer.PutShort(TYPE_FIELD_OFFSET, HDR_TYPE_DATA);
            buffer.PutInt(SESSION_ID_FIELD_OFFSET, sessionId);
            buffer.PutInt(STREAM_ID_FIELD_OFFSET, streamId);
            buffer.PutInt(TERM_ID_FIELD_OFFSET, termId);
            buffer.PutLong(RESERVED_VALUE_OFFSET, DEFAULT_RESERVE_VALUE);

            return buffer;
        }