CreateMemoryStream

<< Click to Display Table of Contents >>

Navigation:  Memory Streams >

CreateMemoryStream

Previous pageReturn to chapter overviewNext page

[Professional Edition and above; .NET, Java, PHP, etc.]

Creates a new empty stream in memory. A memory stream can grow as large as you wish, the size is only limited by available memory. VPE divides a memory stream into chunks of equal size - by default 16 KB. This means that an initial stream only occupies 16 KB of memory. If you write more data to a memory stream, the memory stream is enlarged by additional chunks as required. Internally VPE stores each chunk separately and links each chunk with the next.

This is a method of the VPE document. All other methods and properties described throughout this chapter belong to the TVPEStream object, which is created by this method.

method TVPEStream VPE.CreateMemoryStream(

long chunk_size

)

long chunk_size

The size of each chunk, if you set this parameter to zero, VPE uses a default chunk size of 16 KB, which is a reasonable value.

Returns:

A TVPEStream object for the created memory stream.

 

In case of an error an exception is thrown and LastError is set.

 

You must ALWAYS close all streams you ever opened or created, when you have done using them. Not doing so will result in memory leaks (only at the moment your application is closed, all streams will be released from memory). Neither calling CloseDoc(), nor destroying a TVPEStream object will close a stream.

Remarks:

sets LastError