DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
MemoryStream.h
Go to the documentation of this file.
1#pragma once
2#include "Common.h"
3#include "System/IO/Stream.h"
4#include "System/Array.h"
5
6namespace DotNetDupe {
7 namespace System {
8 namespace IO {
15 class MemoryStream : public Stream {
16 public:
19
22 DOTNETDUPE_API explicit MemoryStream(const Array<char>& buffer);
23
27 DOTNETDUPE_API MemoryStream(const Array<char>& buffer, bool writable);
28
31
34 DOTNETDUPE_API bool CanRead() const override;
35
38 DOTNETDUPE_API bool CanSeek() const override;
39
42 DOTNETDUPE_API bool CanWrite() const override;
43
47 DOTNETDUPE_API long GetLength() const override;
48
52 DOTNETDUPE_API long GetPosition() const override;
53
58 DOTNETDUPE_API void SetPosition(long value) override;
59
61 DOTNETDUPE_API void Flush() override;
62
71 DOTNETDUPE_API int Read(char* buffer, int offset, int count) override;
72
79 DOTNETDUPE_API long Seek(long offset, int origin) override;
80
85 DOTNETDUPE_API void SetLength(long value) override;
86
94 DOTNETDUPE_API void Write(const char* buffer, int offset, int count) override;
95
97 DOTNETDUPE_API void Dispose() override;
98
102
103 private:
104 struct MemoryStreamImpl;
105 MemoryStreamImpl* m_pImpl;
106 };
107 }
108 }
109}
Provides methods for creating, manipulating, searching, and sorting arrays.
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition Array.h:29
void SetLength(long value) override
Sets the length of the current stream to the specified value.
int Read(char *buffer, int offset, int count) override
Reads a block of bytes from the current stream and writes the data to a buffer.
long GetPosition() const override
Gets the current position within the stream.
bool CanSeek() const override
Gets a value indicating whether the current stream supports seeking.
void Flush() override
Overrides the Flush method so that no action is performed.
void Dispose() override
Releases the unmanaged resources used by the MemoryStream.
void SetPosition(long value) override
Sets the current position within the stream.
bool CanRead() const override
Gets a value indicating whether the current stream supports reading.
long Seek(long offset, int origin) override
Sets the position within the current stream to the specified value.
long GetLength() const override
Returns the length of the stream in bytes.
Array< char > ToArray() const
Writes the stream contents to a byte array, regardless of the Position property.
void Write(const char *buffer, int offset, int count) override
Writes a block of bytes to the current stream using data read from a buffer.
MemoryStream()
Initializes a new non-resizable instance of the MemoryStream class with an expandable capacity initia...
bool CanWrite() const override
Gets a value indicating whether the current stream supports writing.
Provides a generic view of a sequence of bytes.
Definition Stream.h:16