Foxit PDF Conversion SDK

Public Member Functions | List of all members
IFX_MemoryStream Class Referenceabstract
FXCRT

Memory stream interface. More...

Inheritance diagram for IFX_MemoryStream:

## Public Member Functions
virtual void | AttachBuffer (FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver=false)=0
| Attach a memory buffer. More...
virtual void | DetachBuffer ()=0
| Detach the current memory buffer. More...
virtual void | EstimateSize (size_t nInitSize, size_t nGrowSize)=0
| Change initialize size and grow size. More...
virtual FX_LPBYTE | GetBuffer () const =0
| Get the current memory buffer. More...
virtual FX_BOOL | IsConsecutive () const =0
| Determine whether the current mode is consecutive or not. More...
Public Member Functions inherited from IFX_FileStream
virtual FX_BOOL | Flush ()=0
| Flush internal buffer. More...
virtual FX_INT64 | GetPosition ()=0
| Get the current reading position in stream. More...
virtual FX_INT64 | GetSize ()=0
| Get the current stream size, in bytes. More...
virtual FX_BOOL | IsEOF ()=0
| Determine whether reach the end of stream. More...
virtual FX_BOOL | ReadBlock (void *buffer, FX_INT64 offset, size_t size)=0
| Read a data block from stream. More...
virtual size_t | ReadBlock (void *buffer, size_t size)=0
| Read data block from stream. More...
virtual void | Release ()=0
| Destroy the current instance. More...
virtual IFX_FileStream * | Retain ()=0
| Create a shared instance. More...
virtual FX_BOOL | WriteBlock (const void *buffer, FX_INT64 offset, size_t size)=0
| Write a block data into stream. More...
virtual FX_BOOL | WriteBlock (const void *buffer, size_t size)
| Write a block data to the end of current stream. More...
Public Member Functions inherited from IFX_FileRead
virtual void | ClearRange ()
| Clear accessing range set by function IFX_FileRead::SetRange. More...
virtual FX_INT64 | SetPosition (FX_INT64 pos)
| Set the current file accessing position. More...
virtual FX_BOOL | SetRange (FX_INT64 offset, FX_INT64 size)
| Set accessing range. More...

## Detailed Description

Memory stream interface.

## Member Function Documentation

## ◆ AttachBuffer()

virtual void IFX_MemoryStream::AttachBuffer | ( | FX_LPBYTE | pBuffer,
|  | size_t | nSize,
|  | FX_BOOL | bTakeOver = `false`
| ) |  |
| pure virtual

Attach a memory buffer.

Parameters

  [in] | pBuffer | Memory buffer to attach.
  [in] | nSize | Buffer size, in bytes.
  [in] | bTakeOver | Indicates whether need free attached memory buffer(pBuffer) when memory stream is to be released. Default value: false

Returns
  None.

Note
  This method will let memory stream works under consecutive mode, that's only one block exists, it will be expanded when writes data into it if necessary. If memory stream works under non-consecutive mode, this method makes no sense.

## ◆ DetachBuffer()

virtual void IFX_MemoryStream::DetachBuffer | ( |  | ) |
| pure virtual

Detach the current memory buffer.

Returns
  None.

Note
  If memory stream works under non-consecutive mode, this method makes no sense.

## ◆ EstimateSize()

virtual void IFX_MemoryStream::EstimateSize | ( | size_t | nInitSize,
|  | size_t | nGrowSize
| ) |  |
| pure virtual

Change initialize size and grow size.

Parameters

  [in] | nInitSize | Initial size for memory block.
  [in] | nGrowSize | Grow up size for next change when write data.

Returns
  None.

Note
  For consecutive mode, if parameter nInitSize is greater than the current size, block memory will be reallocated; parameter nGrowSize will be used when reallocate memory next time. For non-consecutive mode, parameter nGrowSize will be used to allocate each memory block, this method should be called at first; parameter nInitSize will be ignored.

## ◆ GetBuffer()

virtual FX_LPBYTE IFX_MemoryStream::GetBuffer | ( |  | ) | const
| pure virtual

Get the current memory buffer.

Returns
  The current memory buffer.

Note
  If the current memory stream works under non-consecutive mode(there are more than one memory blocks), only the first block returns.

## ◆ IsConsecutive()

virtual FX_BOOL IFX_MemoryStream::IsConsecutive | ( |  | ) | const
| pure virtual

Determine whether the current mode is consecutive or not.

Returns
  true means current mode is consecutive, while false means current mode is non-consecutive.