2 Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
4 Governed by the TrueCrypt License 3.0 the full text of which is contained in
5 the file License.txt included in TrueCrypt binary and source code distribution
10 #include "MemoryStream.h"
14 MemoryStream::MemoryStream (const ConstBufferPtr &data) :
17 Data = vector <byte> (data.Size());
18 BufferPtr (&Data[0], Data.size()).CopyFrom (data);
21 uint64 MemoryStream::Read (const BufferPtr &buffer)
24 throw ParameterIncorrect (SRC_POS);
26 ConstBufferPtr streamBuf (*this);
27 size_t len = buffer.Size();
28 if (streamBuf.Size() - ReadPosition < len)
29 len = streamBuf.Size() - ReadPosition;
31 BufferPtr(buffer).CopyFrom (streamBuf.GetRange (ReadPosition, len));
36 void MemoryStream::ReadCompleteBuffer (const BufferPtr &buffer)
38 if (Read (buffer) != buffer.Size())
39 throw InsufficientData (SRC_POS);
42 void MemoryStream::Write (const ConstBufferPtr &data)
44 for (uint64 i = 0; i < data.Size(); i++)
45 Data.push_back (data[i]);
This page took
0.014661 seconds and
3 git commands to generate. Download a nemesis OSX (sierra+high sierra, tested/working) binary, with fuse-ext3 via e2fsprogs, at
this link. application and installer are signed by screwjack, llc. must install fuse with macFUSE layer first.