Aspose::Pdf::OptimizedMemoryStream Class Reference

Defines a MemoryStream that can contains more standard capacity More...

#include "OptimizedMemoryStream.h"

Inherits System::IO::Stream.

Public Member Functions

ASPOSE_PDF_SHARED_API bool get_CanRead () const override
 When overridden in a derived class, gets a value indicating whether the current stream supports reading. More...
 
ASPOSE_PDF_SHARED_API bool get_CanSeek () const override
 When overridden in a derived class, gets a value indicating whether the current stream supports seeking. More...
 
ASPOSE_PDF_SHARED_API bool get_CanWrite () const override
 When overridden in a derived class, gets a value indicating whether the current stream supports writing. More...
 
ASPOSE_PDF_SHARED_API int32_t get_BufferSize () const
 Gets the size of the underlying buffers. More...
 
ASPOSE_PDF_SHARED_API void set_BufferSize (int32_t value)
 Sets the size of the underlying buffers. More...
 
ASPOSE_PDF_SHARED_API int64_t get_Length () const override
 When overridden in a derived class, gets the length in bytes of the stream. More...
 
ASPOSE_PDF_SHARED_API int64_t get_Position () const override
 When overridden in a derived class, gets or sets the position within the current stream. More...
 
ASPOSE_PDF_SHARED_API void set_Position (int64_t value) override
 When overridden in a derived class, gets or sets the position within the current stream. More...
 
ASPOSE_PDF_SHARED_API bool get_FreeOnDispose () const
 Gets a value indicating whether to free the underlying buffers on dispose. More...
 
ASPOSE_PDF_SHARED_API void set_FreeOnDispose (bool value)
 Sets a value indicating whether to free the underlying buffers on dispose. More...
 
ASPOSE_PDF_SHARED_API OptimizedMemoryStream ()
 Initializes a new instance of the OptimizedMemoryStream class. More...
 
ASPOSE_PDF_SHARED_API OptimizedMemoryStream (int32_t bufferSize, System::ArrayPtr< uint8_t > buffer)
 Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array. More...
 
ASPOSE_PDF_SHARED_API OptimizedMemoryStream (int32_t bufferSize)
 Initializes a new instance of the OptimizedMemoryStream class. More...
 
ASPOSE_PDF_SHARED_API OptimizedMemoryStream (System::ArrayPtr< uint8_t > buffer)
 Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array. More...
 
ASPOSE_PDF_SHARED_API int32_t Read (const System::ArrayPtr< uint8_t > &buffer, int32_t offset, int32_t count) override
 When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. More...
 
ASPOSE_PDF_SHARED_API int32_t ReadByte () override
 Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream. More...
 
ASPOSE_PDF_SHARED_API int64_t Seek (int64_t offset, System::IO::SeekOrigin origin) override
 When overridden in a derived class, sets the position within the current stream. More...
 
ASPOSE_PDF_SHARED_API void Flush () override
 The function overrided. More...
 
ASPOSE_PDF_SHARED_API void SetLength (int64_t value) override
 When overridden in a derived class, sets the length of the current stream. More...
 
ASPOSE_PDF_SHARED_API System::ArrayPtr< uint8_t > ToArray ()
 Converts the current stream to a byte array. More...
 
ASPOSE_PDF_SHARED_API void Write (const System::ArrayPtr< uint8_t > &buffer, int32_t offset, int32_t count) override
 When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. More...
 
ASPOSE_PDF_SHARED_API void WriteByte (uint8_t value) override
 Writes a byte to the current position in the stream and advances the position within the stream by one byte. More...
 
ASPOSE_PDF_SHARED_API void WriteTo (System::SharedPtr< System::IO::Stream > stream)
 Writes to the specified stream. More...
 
- Public Member Functions inherited from System::IO::Stream
virtual ASPOSECPP_SHARED_API 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. More...
 
virtual ASPOSECPP_SHARED_API 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. More...
 
template<std::size_t N>
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. More...
 
template<std::size_t N>
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. More...
 
virtual void Close ()
 Closes the stream. More...
 
ASPOSECPP_SHARED_API void Dispose () override
 Releases all resources used by the current object and closes the stream. More...
 
virtual ASPOSECPP_SHARED_API System::SharedPtr< System::IAsyncResultBeginRead (System::ArrayPtr< uint8_t > buffer, int offset, int count, System::AsyncCallback callback, System::SharedPtr< System::Object > state)
 Initiates an asynchronous read operation. More...
 
virtual ASPOSECPP_SHARED_API System::SharedPtr< System::IAsyncResultBeginWrite (System::ArrayPtr< uint8_t > buffer, int offset, int count, System::AsyncCallback callback, System::SharedPtr< System::Object > state)
 Initiates an asynchronous write operation. More...
 
virtual ASPOSECPP_SHARED_API int EndRead (System::SharedPtr< System::IAsyncResult > asyncResult)
 Waits until the specified asynchronous read operation completes. More...
 
virtual ASPOSECPP_SHARED_API void EndWrite (System::SharedPtr< System::IAsyncResult > asyncResult)
 Ends an asynchronous write operation. Waits until the specified asynchronous write operation completes. More...
 
ASPOSECPP_SHARED_API void CopyTo (const SharedPtr< Stream > &destination)
 Copies bytes to the specified stream. More...
 
ASPOSECPP_SHARED_API void CopyTo (const SharedPtr< Stream > &destination, int32_t buffer_size)
 Copies bytes to the specified stream, using the specified buffer size. More...
 
virtual ASPOSECPP_SHARED_API bool get_CanTimeout () const
 Gets a value that determines whether the current stream can time out. More...
 
virtual ASPOSECPP_SHARED_API void set_ReadTimeout (int timeout)
 Sets a value that determines whether the current stream can time out. More...
 
virtual ASPOSECPP_SHARED_API int get_ReadTimeout () const
 Gets a value, in milliseconds, that determines how long the stream will attempt to read before timing out. More...
 
virtual ASPOSECPP_SHARED_API void set_WriteTimeout (int timeout)
 Sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out. More...
 
virtual ASPOSECPP_SHARED_API int get_WriteTimeout () const
 Gets a value, in milliseconds, that determines how long the stream will attempt to write before timing out. More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual ASPOSECPP_SHARED_API bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool Equals (double const &objA, double const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Static Public Attributes

static const ASPOSE_PDF_SHARED_API int32_t DefaultBufferSize
 Default buffer size value in bytes. More...
 
- Static Public Attributes inherited from System::IO::Stream
static const System::SharedPtr< Stream > ASPOSECPP_SHARED_API Null
 A stream with no underlying storage. More...
 

Protected Member Functions

ASPOSE_PDF_SHARED_API void Dispose (bool disposing) override
 Releases the unmanaged resources used by the T:System::IO::Stream and optionally releases the managed resources. More...
 

Additional Inherited Members

- Public Types inherited from System::IO::Stream
typedef SharedPtr< StreamPtr
 An alias for a shared pointer to this class. More...
 
- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 

Detailed Description

Defines a MemoryStream that can contains more standard capacity

Constructor & Destructor Documentation

◆ OptimizedMemoryStream() [1/4]

ASPOSE_PDF_SHARED_API Aspose::Pdf::OptimizedMemoryStream::OptimizedMemoryStream ( )

Initializes a new instance of the OptimizedMemoryStream class.

◆ OptimizedMemoryStream() [2/4]

ASPOSE_PDF_SHARED_API Aspose::Pdf::OptimizedMemoryStream::OptimizedMemoryStream ( int32_t  bufferSize,
System::ArrayPtr< uint8_t >  buffer 
)

Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array.

Parameters
bufferSizeSize of the underlying buffers.
bufferThe array of unsigned bytes from which to create the current stream.

◆ OptimizedMemoryStream() [3/4]

ASPOSE_PDF_SHARED_API Aspose::Pdf::OptimizedMemoryStream::OptimizedMemoryStream ( int32_t  bufferSize)

Initializes a new instance of the OptimizedMemoryStream class.

Parameters
bufferSizeSize of the underlying buffers.

◆ OptimizedMemoryStream() [4/4]

ASPOSE_PDF_SHARED_API Aspose::Pdf::OptimizedMemoryStream::OptimizedMemoryStream ( System::ArrayPtr< uint8_t >  buffer)

Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array.

Parameters
bufferThe array of unsigned bytes from which to create the current stream.

Member Function Documentation

◆ Dispose()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::Dispose ( bool  disposing)
overrideprotectedvirtual

Releases the unmanaged resources used by the T:System::IO::Stream and optionally releases the managed resources.

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.

Reimplemented from System::IO::Stream.

◆ Flush()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::Flush ( )
overridevirtual

The function overrided.

Implements System::IO::Stream.

◆ get_BufferSize()

ASPOSE_PDF_SHARED_API int32_t Aspose::Pdf::OptimizedMemoryStream::get_BufferSize ( ) const

Gets the size of the underlying buffers.

The buffers size.

◆ get_CanRead()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::OptimizedMemoryStream::get_CanRead ( ) const
overridevirtual

When overridden in a derived class, gets a value indicating whether the current stream supports reading.

Returns
true if the stream supports reading; otherwise, false.

Implements System::IO::Stream.

◆ get_CanSeek()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::OptimizedMemoryStream::get_CanSeek ( ) const
overridevirtual

When overridden in a derived class, gets a value indicating whether the current stream supports seeking.

Returns
true if the stream supports seeking; otherwise, false.

Implements System::IO::Stream.

◆ get_CanWrite()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::OptimizedMemoryStream::get_CanWrite ( ) const
overridevirtual

When overridden in a derived class, gets a value indicating whether the current stream supports writing.

Returns
true if the stream supports writing; otherwise, false.

Implements System::IO::Stream.

◆ get_FreeOnDispose()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::OptimizedMemoryStream::get_FreeOnDispose ( ) const

Gets a value indicating whether to free the underlying buffers on dispose.

◆ get_Length()

ASPOSE_PDF_SHARED_API int64_t Aspose::Pdf::OptimizedMemoryStream::get_Length ( ) const
overridevirtual

When overridden in a derived class, gets the length in bytes of the stream.

Returns
A long value representing the length of the stream in bytes.

Implements System::IO::Stream.

◆ get_Position()

ASPOSE_PDF_SHARED_API int64_t Aspose::Pdf::OptimizedMemoryStream::get_Position ( ) const
overridevirtual

When overridden in a derived class, gets or sets the position within the current stream.

Returns
The current position within the stream.

Implements System::IO::Stream.

◆ Read()

ASPOSE_PDF_SHARED_API int32_t Aspose::Pdf::OptimizedMemoryStream::Read ( const System::ArrayPtr< uint8_t > &  buffer,
int32_t  offset,
int32_t  count 
)
overridevirtual

When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Parameters
bufferAn array of bytes. When this method returns, the buffer contains the specified byte array with the values
offsetThe zero-based byte offset in at which to begin storing the data read from the current stream.
countThe maximum number of bytes to be read from the current stream.
Returns
The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

Implements System::IO::Stream.

◆ ReadByte()

ASPOSE_PDF_SHARED_API int32_t Aspose::Pdf::OptimizedMemoryStream::ReadByte ( )
overridevirtual

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

Returns
byte or -1 if at the end of the stream.

Reimplemented from System::IO::Stream.

◆ Seek()

ASPOSE_PDF_SHARED_API int64_t Aspose::Pdf::OptimizedMemoryStream::Seek ( int64_t  offset,
System::IO::SeekOrigin  origin 
)
overridevirtual

When overridden in a derived class, sets the position within the current stream.

Parameters
offsetA byte offset relative to the origin parameter.
originA value of type T:System::IO::SeekOrigin indicating the reference point used to obtain the new position.
Returns
The new position within the current stream.

Implements System::IO::Stream.

◆ set_BufferSize()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::set_BufferSize ( int32_t  value)

Sets the size of the underlying buffers.

The buffers size.

◆ set_FreeOnDispose()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::set_FreeOnDispose ( bool  value)

Sets a value indicating whether to free the underlying buffers on dispose.

◆ set_Position()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::set_Position ( int64_t  value)
overridevirtual

When overridden in a derived class, gets or sets the position within the current stream.

Returns
The current position within the stream.

Implements System::IO::Stream.

◆ SetLength()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::SetLength ( int64_t  value)
overridevirtual

When overridden in a derived class, sets the length of the current stream.

Parameters
valueThe desired length of the current stream in bytes.

Implements System::IO::Stream.

◆ ToArray()

ASPOSE_PDF_SHARED_API System::ArrayPtr<uint8_t> Aspose::Pdf::OptimizedMemoryStream::ToArray ( )

Converts the current stream to a byte array.

Returns
An array of bytes

◆ Write()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::Write ( const System::ArrayPtr< uint8_t > &  buffer,
int32_t  offset,
int32_t  count 
)
overridevirtual

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Parameters
bufferAn array of bytes. This method copies count bytes from buffer to the current stream.
offsetThe zero-based byte offset in buffer at which to begin copying bytes to the current stream.
countThe number of bytes to be written to the current stream.

The sum of offset and count is greater than the buffer length.

Implements System::IO::Stream.

◆ WriteByte()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::WriteByte ( uint8_t  value)
overridevirtual

Writes a byte to the current position in the stream and advances the position within the stream by one byte.

Parameters
valueThe byte to write to the stream.

Reimplemented from System::IO::Stream.

◆ WriteTo()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::OptimizedMemoryStream::WriteTo ( System::SharedPtr< System::IO::Stream stream)

Writes to the specified stream.

Parameters
streamThe stream.

Member Data Documentation

◆ DefaultBufferSize

const ASPOSE_PDF_SHARED_API int32_t Aspose::Pdf::OptimizedMemoryStream::DefaultBufferSize
static

Default buffer size value in bytes.