blob: eebaa2cc02e4dd835132bf59ef77ca07ec02925a (
plain)
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
29
|
// ArduinoJson - https://arduinojson.org
// Copyright Benoit Blanchon 2014-2021
// MIT License
#pragma once
#include <istream>
namespace ARDUINOJSON_NAMESPACE {
template <typename TSource>
struct Reader<TSource, typename enable_if<
is_base_of<std::istream, TSource>::value>::type> {
public:
explicit Reader(std::istream& stream) : _stream(&stream) {}
int read() {
return _stream->get();
}
size_t readBytes(char* buffer, size_t length) {
_stream->read(buffer, static_cast<std::streamsize>(length));
return static_cast<size_t>(_stream->gcount());
}
private:
std::istream* _stream;
};
} // namespace ARDUINOJSON_NAMESPACE
|