Writes data from specified input parameters to a MemoryOutputStream object. Returns the total number of characters written for CHARACTER and LONGCHAR data parameter, or the total number of bytes written for a MEMPTR parameter.
Return type: INT64
Access: PUBLIC
Applies to:Progress.IO.MemoryOutputStream class
Write(INPUT source-data AS MEMPTR, INPUT offset AS INT64,INPUT length AS INT64) Write(INPUT source-data AS CHARACTER) Write(INPUT source-data AS CHARACTER, INPUT incldNull AS LOGICAL) Write(INPUT source-data AS LONGCHAR) Write(INPUT source-data AS LONGCHAR, INPUT incldNull AS LOGICAL)) |
DEFINE VAR outMs AS Progress.io.MemoryOutputStream. DEFINE VAR mem AS MEMPTR. DEFINE VAR len AS INT64. DEFINE VAR ret AS INT64. DEFINE VAR mylc AS LONGCHAR. outMs = NEW Progress.io.MemoryOutputStream(). mylc = "123456789". ret = outMs:Write(mylc,yes). MESSAGE ret " == " outMs:BytesWritten " == " 10 VIEW-AS ALERT-BOX. outMs:Clear(). outMs = NEW Progress.io.MemoryOutputStream(). mylc = "123456789". ret = outMs:Write(mylc). //null terminator will be exclued MESSAGE ret " == " outMs:BytesWritten " == " 9 VIEW-AS ALERT-BOX. outMs:Clear(). SET-SIZE(mem) = 11. PUT-STRING(mem,1) = "123456789". ret = outMs:Write(mem, 1, LENGTH(STRING(mem))). MESSAGE "123456789 == " STRING(outMs:Data) VIEW-AS ALERT-BOX. |
The following table illustrates values that result from constructors and Write( )/Clear( ) methods: