2#ifndef _aspose_system_io_memory_stream_h_
3#define _aspose_system_io_memory_stream_h_
5#include "system/io/stream.h"
6#include "system/array.h"
7#include "system/array_segment.h"
8#include "system/reflection.h"
12namespace System {
namespace IO {
63 ASPOSECPP_SHARED_API
void WriteByte(uint8_t value)
override;
80 ASPOSECPP_SHARED_API int32_t
Read(
const System::Details::ArrayView<uint8_t>& buffer, int32_t offset, int32_t count)
override;
85 ASPOSECPP_SHARED_API
void Write(
const System::Details::ArrayView<uint8_t>& buffer, int32_t offset, int32_t count)
override;
91 ASPOSECPP_SHARED_API int64_t
Seek(int64_t offset,
SeekOrigin origin)
override;
93 ASPOSECPP_SHARED_API
void SetLength(int64_t value)
override;
95 ASPOSECPP_SHARED_API
void Flush()
override;
124 virtual ASPOSECPP_SHARED_API
void Close()
override;
128 void CheckIfClosedThrowDisposed()
const;
131 void Expand (
int newSize);
135 int CalculateNewCapacity (
int minimum);
141 int32_t InternalGetPosition()
const;
147 int32_t InternalEmulateRead(int32_t count);
152 uint8_t* pCurrentPosition =
nullptr;
156 bool m_readable =
true;
158 bool m_seekable =
true;
172 bool _publiclyVisible;
176#ifdef ASPOSE_GET_SHARED_MEMBERS
178 virtual ASPOSECPP_SHARED_API
void GetSharedMembers(System::Object::shared_members_type& result)
const override;
181#ifdef __DBG_FOR_EACH_MEMBER
183 void DBG_for_each_member(DBG::for_each_member_visitor &visitor)
const override
185 visitor.add_self(
this);
188 const char* DBG_class_name()
const override {
return "MemoryStream"; }
Represents a segment of the one-dimensional array. Objects of this class should only be allocated usi...
Definition: array_segment.h:63
Represents a reader that reads primitive data types as binary data in particular encoding....
Definition: binary_reader.h:26
Represents a stream that reads from and writes to memory. Objects of this class should only be alloca...
Definition: memory_stream.h:19
MemoryStream(const ArrayPtr< uint8_t > &content, int index, int count, bool writable=true, bool publiclyVisible=false)
Constructs a new instance of the MemoryStream class that represents a memory stream which is connecte...
int get_Capacity()
Returns the current capacity of the underlying memory buffer.
bool TryGetBuffer(ArraySegment< uint8_t > &buffer)
Returns the array of unsigned bytes from which this stream was created.
int32_t Read(const System::Details::ArrayView< uint8_t > &buffer, int32_t offset, int32_t count) override
Reads the specified number of bytes from the stream and writes them to the specified byte array.
void SetLength(int64_t value) override
Sets the length of the stream represented by the current object.
bool get_CanSeek() const override
Determines if the stream supports seeking.
MemoryStream(int capacity_)
Constructs a new instance of the MemoryStream class that represents a stream based on a memory buffer...
bool get_CanWrite() const override
Determines if the stream is writable.
virtual void Close() override
Closes the stream.
void Write(const System::Details::ArrayView< uint8_t > &buffer, int32_t offset, int32_t count) override
Writes the specified subrange of bytes from the specified byte array to the stream.
System::SharedPtr< System::IO::MemoryStream > Ptr
An alias for a shared pointer to the self.
Definition: memory_stream.h:26
int64_t get_Length() const override
Returns the length of the stream in bytes.
int ReadByte() override
Reads a single byte from the stream and returns a 32-bit integer value equivalent to the value of the...
void Write(const ArrayPtr< uint8_t > &buffer, int32_t offset, int32_t count) override
Writes the specified subrange of bytes from the specified byte array to the stream.
virtual ArrayPtr< uint8_t > ToArray()
Returns a copy of underlying memory buffer as an array of bytes.
MemoryStream()
Constructs a new instance of the MemoryStream class with initial capacity equal to 0.
virtual void WriteTo(SharedPtr< Stream > stream)
Writes the content of the underlying buffer to the specified stream.
void Flush() override
Does nothing.
void WriteByte(uint8_t value) override
Writes the specified unsigned 8-bit integer value to the stream.
void set_Position(int64_t value) override
Sets the stream's position.
int64_t get_Position() const override
Returns the current position of the stream.
void set_Capacity(int value)
Sets the capacity of the underlying memory buffer.
MemoryStream(const ArrayPtr< uint8_t > &content, bool writable=true)
Constructs a new instance of the MemoryStream class that represents a memory stream which is connecte...
int32_t Read(const ArrayPtr< uint8_t > &buffer, int32_t offset, int32_t count) override
Reads the specified number of bytes from the stream and writes them to the specified byte array.
bool get_CanRead() const override
Determines if the stream is readable.
int64_t Seek(int64_t offset, SeekOrigin origin) override
Sets the position of the stream represented by the current object.
virtual ArrayPtr< uint8_t > GetBuffer()
Returns a pointer to the underlying buffer.
A base class for a variety of stream implementations. Objects of this class should only be allocated ...
Definition: stream.h:24
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
SeekOrigin
Specifies the reference position in the stream relative to which the position to seek to is specified...
Definition: seekorigin.h:11
Definition: db_command.h:9