The Memory Stream Connector can read from or write to any Java™ stream, but is most often used
to write into memory, where the formatted data can be retrieved later.
You can use the information provided here to know about the operation
modes and the behaviour.
The allocated buffer is retrieved/accessed as needed.
Note: The
memory stream is confined to the local JVM, so it's not possible to
interchange data with a task running in another JVM; be it on the
same machine or a different one.
The Connector can only operate in Iterator mode, AddOnly
mode, or Passive state. The behavior of the Connector depends on the
way it has been initialized.
- initialize(null)
- This is the default behavior. The Connector writes into memory,
and the formatted data can be retrieved with the method getDataBuffer(),
only available in Memory Stream Connectors. Assuming the Connector
is named MM, this code can be used anywhere (for example, Prolog,
Epilog, all Hooks, script components, and even inside attribute mapping):
var str = MM.connector.getDataBuffer();
// use str for something.
// To clear the data buffer and ready the Connector
for more output, re-initialize
MM.connector.initialize(null);
- initialize(Reader r)
- The Connector reads from r. This can be used if you want
to read from a stream.
- initialize(Writer w)
- The Connector writes to w.
- initialize(Socket s)
- The Connector can both read from and write to a Socket s.
Note: Do not reinitialize unless you want to start reading
from or writing to another data stream. If you want to use the Connector
Interface object, see
The Connector Interface object.
This Connector has an additional method, the getDataBuffer() method.