/* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include #include #include #include using namespace Swift; std::shared_ptr ByteArrayReadBytestream::read(size_t size) { size_t readSize = size; if (position + readSize > data.size()) { readSize = data.size() - position; } std::shared_ptr result = std::make_shared( data.begin() + boost::numeric_cast(position), data.begin() + boost::numeric_cast(position) + boost::numeric_cast(readSize)); onRead(*result); position += readSize; return result; } void ByteArrayReadBytestream::addData(const std::vector& moreData) { append(data, moreData); onDataAvailable(); }