2#ifndef _aspose_system_io_stream_h_
3#define _aspose_system_io_stream_h_
5#include "system/array.h"
6#include "system/idisposable.h"
7#include "system/io/seekorigin.h"
8#include "system/async_callback.h"
10#include "system/details/array_view.h"
12#include "system/exceptions.h"
18namespace System {
namespace IO {
38 virtual ASPOSECPP_SHARED_API
void WriteByte(uint8_t value);
57 virtual ASPOSECPP_SHARED_API int32_t
Read(
const System::Details::ArrayView<uint8_t>& buffer, int32_t offset, int32_t count);
62 virtual ASPOSECPP_SHARED_API
void Write(
const System::Details::ArrayView<uint8_t>& buffer, int32_t offset, int32_t count);
69 template<std::
size_t N>
70 int32_t
Read(
const System::Details::StackArray<uint8_t, N>& buffer, int32_t offset, int32_t count)
72 return Read(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, count);
79 template<std::
size_t N>
80 void Write(
const System::Details::StackArray<uint8_t, N>& buffer, int32_t offset, int32_t count)
82 Write(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, count);
89 virtual ASPOSECPP_SHARED_API int64_t
Seek(int64_t offset,
SeekOrigin origin) = 0;
92 virtual ASPOSECPP_SHARED_API
void SetLength(int64_t value) = 0;
94 virtual ASPOSECPP_SHARED_API
void Flush() = 0;
98 ASPOSECPP_SHARED_API
void Dispose()
override;
173 virtual ASPOSECPP_SHARED_API
void Dispose(
bool disposing);
Defines method that releases resources owned by the current object. Objects of this class should only...
Definition: idisposable.h:30
A base class for a variety of stream implementations. Objects of this class should only be allocated ...
Definition: stream.h:24
virtual void EndWrite(System::SharedPtr< System::IAsyncResult > asyncResult)
Ends an asynchronous write operation. Waits until the specified asynchronous write operation complete...
virtual int64_t get_Length() const =0
Returns the length of the stream in bytes.
static const System::SharedPtr< Stream > Null
A stream with no underlying storage.
Definition: stream.h:168
virtual int32_t Read(const ArrayPtr< uint8_t > &buffer, int32_t offset, int32_t count)=0
Reads the specified number of bytes from the stream and writes them to the specified byte array.
virtual void set_WriteTimeout(int timeout)
Sets a value, in milliseconds, that determines how long the stream will attempt to read before timing...
void CopyTo(const SharedPtr< Stream > &destination, int32_t buffer_size)
Copies bytes to the specified stream, using the specified buffer size.
virtual System::SharedPtr< System::IAsyncResult > BeginWrite(System::ArrayPtr< uint8_t > buffer, int offset, int count, System::AsyncCallback callback, System::SharedPtr< System::Object > state)
Initiates an asynchronous write operation.
virtual int EndRead(System::SharedPtr< System::IAsyncResult > asyncResult)
Waits until the specified asynchronous read operation completes.
virtual void Write(const ArrayPtr< uint8_t > &buffer, int32_t offset, int32_t count)=0
Writes the specified subrange of bytes from the specified byte array to the stream.
virtual bool get_CanTimeout() const
Gets a value that determines whether the current stream can time out.
virtual int64_t get_Position() const =0
Returns the current position of the stream.
void Dispose() override
Releases all resources used by the current object and closes the stream.
SharedPtr< Stream > Ptr
An alias for a shared pointer to this class.
Definition: stream.h:29
virtual bool get_CanWrite() const =0
Determines if the stream is writable.
virtual int get_WriteTimeout() const
Gets a value, in milliseconds, that determines how long the stream will attempt to write before timin...
void Write(const System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t count)
Writes the specified subrange of bytes from the specified byte array to the stream.
Definition: stream.h:80
virtual void Dispose(bool disposing)
Releases all resources used by the current object and closes the stream.
virtual bool get_CanSeek() const =0
Determines if the stream supports seeking.
virtual void Flush()=0
Clears this stream's buffers and writes all buffered data to the underlying storage.
virtual void WriteByte(uint8_t value)
Writes the specified unsigned 8-bit integer value to the stream.
int32_t Read(const System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t count)
Reads the specified number of bytes from the stream and writes them to the specified byte array.
Definition: stream.h:70
virtual void SetLength(int64_t value)=0
Sets the length of the stream represented by the current object.
virtual System::SharedPtr< System::IAsyncResult > BeginRead(System::ArrayPtr< uint8_t > buffer, int offset, int count, System::AsyncCallback callback, System::SharedPtr< System::Object > state)
Initiates an asynchronous read operation.
virtual bool get_CanRead() const =0
Determines if the stream is readable.
virtual int get_ReadTimeout() const
Gets a value, in milliseconds, that determines how long the stream will attempt to read before timing...
virtual void set_ReadTimeout(int timeout)
Sets a value that determines whether the current stream can time out.
virtual void Write(const System::Details::ArrayView< uint8_t > &buffer, int32_t offset, int32_t count)
Writes the specified subrange of bytes from the specified byte array to the stream.
virtual void Close()
Closes the stream.
Definition: stream.h:96
virtual int32_t Read(const System::Details::ArrayView< uint8_t > &buffer, int32_t offset, int32_t count)
Reads the specified number of bytes from the stream and writes them to the specified byte array.
virtual int ReadByte()
Reads a single byte from the stream and returns a 32-bit integer value equivalent to the value of the...
virtual void set_Position(int64_t value)=0
Sets the stream's position.
void CopyTo(const SharedPtr< Stream > &destination)
Copies bytes to the specified stream.
virtual int64_t Seek(int64_t offset, SeekOrigin origin)=0
Sets the position of the stream represented by the current object.
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
System::MulticastDelegate< void(SharedPtr< IAsyncResult >)> AsyncCallback
A delegate type that represents a method to be called when asynchronous operation completes.
Definition: async_callback.h:13