Defining a MEMPTR with Memory Stream classes
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
The memory stream classes, Progress.IO.MemoryOutputStream and Progress.IO.MemoryInputStream encapsulate the MEMPTR data type, and make
it easier to perform MEMPTR operations.
For example, you can write to memory referenced by a MEMPTR without worrying about resizing, keeping track of read/write positions, or remembering when to free it. The memory stream object automatically resizes the MEMPTR structure when needed and frees it when the stream object goes out of scope.
GET-STRING, GET-BYTES, GET-SIZE and so on. Any write operations such as PUT-STRING, PUT-BYTE, or SET-SIZE on this property causes a runtime error indicating
that AVM is unable to perform such operation on a read only MEMPTR.The following ABL code samples demonstrate how memory stream classes simplify the use of MEMPTRs.
MEMPTRs defined without using memory stream classes
|
MEMPTRs defined as memory stream classes
|
See the ABL Reference for more information about these memory stream classes.