aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp
blob: f8640f0e8c21ab32bf78a0ac90f5d4dd37ef3718 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */
#include <aws/core/utils/event/EventEncoderStream.h>
#include <iostream>

namespace Aws
{
    namespace Utils
    {
        namespace Event
        {
            EventEncoderStream::EventEncoderStream(size_t bufferSize) :
                Aws::IOStream(&m_streambuf),
                m_streambuf(bufferSize)
            {
            }

            EventEncoderStream& EventEncoderStream::WriteEvent(const Aws::Utils::Event::Message& msg)
            {
                auto bits = m_encoder.EncodeAndSign(msg);
                write(reinterpret_cast<char*>(bits.data()), bits.size());
                return *this;
            }
        }
    }
}