blob: 29efffbd067b542987146aeda48b583c61b46731 [file] [log] [blame]
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
namespace Js
{
//
// Helper class to implement stream reader/writer. Note that this stream helper class
// maintains its own stream position and ensures the stream position fits scaposition_t.
//
class StreamHelper: public ScriptContextHolder
{
private:
HostStream *m_stream;
protected:
HostStream* GetStream() const
{
return m_stream;
}
void ThrowOverflow() const
{
::Math::DefaultOverflowPolicy();
}
public:
StreamHelper(ScriptContext* scriptContext, HostStream* stream)
: ScriptContextHolder(scriptContext),
m_stream(stream)
{
}
};
}