Ejemplo n.º 1
0
        /**
         * Store the default frame header to the log meta data buffer.
         *
         * @param logMetaDataBuffer into which the default headers should be stored.
         * @param defaultHeader     to be stored.
         * @throws IllegalArgumentException if the default header is larger than {@link #LOG_DEFAULT_FRAME_HEADER_MAX_LENGTH}
         */
        public static void StoreDefaultFrameHeader(DirectBuffer logMetaDataBuffer, DirectBuffer defaultHeader)
        {
            if (defaultHeader.Length != DataHeaderFlyweight.HEADER_LENGTH)
            {
                throw new InvalidOperationException(String.Format(
                                                        "Default header of %d not equal to %d", defaultHeader.Length, DataHeaderFlyweight.HEADER_LENGTH));
            }

            logMetaDataBuffer.WriteInt32(LOG_DEFAULT_FRAME_HEADER_LENGTH_OFFSET, DataHeaderFlyweight.HEADER_LENGTH);
            defaultHeader.Copy(logMetaDataBuffer.Data + LOG_DEFAULT_FRAME_HEADER_OFFSET, 0, DataHeaderFlyweight.HEADER_LENGTH);
            //logMetaDataBuffer.putBytes(LOG_DEFAULT_FRAME_HEADER_OFFSET, defaultHeader, 0, HeaderFlyweight.HEADER_LENGTH);
        }
Ejemplo n.º 2
0
 /**
  * Apply the default header for a message in a term.
  *
  * @param logMetaDataBuffer containing the default headers.
  * @param termBuffer        to which the default header should be applied.
  * @param termOffset        at which the default should be applied.
  */
 public static void ApplyDefaultHeader(
     DirectBuffer logMetaDataBuffer, DirectBuffer termBuffer, int termOffset)
 {
     logMetaDataBuffer.Copy(termBuffer.Data + termOffset, LOG_DEFAULT_FRAME_HEADER_OFFSET, DataHeaderFlyweight.HEADER_LENGTH);
     //termBuffer.putBytes(termOffset, logMetaDataBuffer, LOG_DEFAULT_FRAME_HEADER_OFFSET, DataHeaderFlyweight.HEADER_LENGTH);
 }