This class is responsible for reading data from memory. It acts as a wrapper for MEMPTR read operations.
Progress.IO.MemoryInputStream extends Progress.IO.InputStream:
As with other input stream classes, the MemoryInputputStream class maintains its own internal read position and eliminates the need to keep track of MEMPTR read positions.
PUBLIC MemoryInputStream ( INPUT mos AS Progress.IO.MemoryOutputStream ) PUBLIC MemoryInputStream ( INPUT mem AS MEMPTR ) |
DEFINE VARIABLE testDate AS DATE INITIAL "4/10/56". DEFINE VARIABLE testDouble AS DECIMAL INITIAL 42.42. DEFINE VARIABLE testFloat AS DECIMAL INITIAL 42.42. DEFINE VARIABLE testLong AS INTEGER INITIAL 42. DEFINE VARIABLE testShort AS INTEGER INITIAL 42. DEFINE VARIABLE testString AS CHARACTER INITIAL "Progress". DEFINE VAR InMs AS Progress.io.MemoryInputStream. outMs = NEW Progress.io.MemoryOutputStream(). outMs:WriteLong(INTEGER( testDate )). outMs:WriteDouble(testDouble). outMs:WriteFloat( testFLOAT). outMs:WriteLong(testLONG). outMs:WriteShort(testSHORT). outMs:Write(testString). InMs = NEW Progress.io.MemoryInputStream(INPUT outMs:Data ). MESSAGE InMs:ReadLong() SKIP InMs:ReadDouble() SKIP InMs:ReadFloat() SKIP InMs:ReadLong() SKIP InMs:ReadShort() SKIP InMs:ReadString() VIEW-AS ALERT-BOX. |
DEFINE VAR InMs1 AS Progress.io.MemoryInputStream. DEFINE VAR InMs2 AS Progress.io.MemoryInputStream. DEFINE VAR outMs AS Progress.io.MemoryOutputStream. DEFINE VAR len AS INT64. DEFINE VAR ret AS INT64. DEFINE VAR ch AS CHAR. DEFINE VAR lc1 AS CHAR. outMs = NEW Progress.io.MemoryOutputStream(). outMs:Write("PROGRESS1",YES). outMs:Write("PROGRESSx2",YES). InMs1 = NEW Progress.io.MemoryInputStream(INPUT outMs). MESSAGE InMs1:ReadSTRING() VIEW-AS ALERT-BOX. MESSAGE InMs1:ReadLONGCHAR() VIEW-AS ALERT-BOX. |