/**
 * @file String related streams
 * @since 0.1.9
 */
/*#ifndef(UMD)*/
"use strict";
/*global _gpfDefine*/ // Shortcut for gpf.define
/*global _gpfStreamSecureInstallProgressFlag*/ // Install the progress flag used by _gpfStreamSecureRead and Write
/*global _gpfStreamSecureRead*/ // Generate a wrapper to secure multiple calls to stream#read
/*global _gpfStreamSecureWrite*/ // Generates a wrapper to secure multiple calls to stream#write
/*#endif*/

var
    _gpfStreamReadableString = _gpfDefine(/** @lends gpf.node.ReadableString */ {
        $class: "gpf.stream.ReadableString",

        /**
         * Wraps a string inside a readable stream
         *
         * @constructor gpf.node.ReadableString
         * @implements {gpf.interfaces.IReadableStream}
         * @param {String} buffer String buffer
         * @since 0.1.9
         */
        constructor: function (buffer) {
            this._buffer = buffer;
        },

        //region gpf.interfaces.IReadableStream

        /**
         * @gpf:sameas gpf.interfaces.IReadableStream#read
         * @since 0.1.9
         */
        read: _gpfStreamSecureRead(function (output) {
            return output.write(this._buffer); //eslint-disable-line no-invalid-this
        }),

        //endregion

        /**
         * Buffer
         * @since 0.1.9
         */
        _buffer: ""

    }),

    /**
     * @since 0.1.9
     */
    _gpfStreamWritableString = _gpfDefine(/** @lends gpf.node.WritableString */ {
        $class: "gpf.stream.WritableString",

        /**
         * Creates a writable stream that can be converted to string
         *
         * @constructor gpf.node.WritableString
         * @implements {gpf.interfaces.IWritableStream}
         * @since 0.1.9
         */
        constructor: function () {
            this._buffer = [];
        },

        //region gpf.interfaces.IReadableStream

        /**
         * @gpf:sameas gpf.interfaces.IWritableStream#write
         * @since 0.1.9
         */
        write: _gpfStreamSecureWrite(function (buffer) {
            this._buffer.push(buffer.toString()); //eslint-disable-line no-invalid-this
            return Promise.resolve();
        }),

        //endregion

        toString: function () {
            return this._buffer.join("");
        },

        /**
         * Buffer
         *
         * @type {String[]}
         * @since 0.1.9
         */
        _buffer: []

    });

_gpfStreamSecureInstallProgressFlag(_gpfStreamReadableString);
_gpfStreamSecureInstallProgressFlag(_gpfStreamWritableString);

@@ -435,16 +435,150 @@
 m#write%0A
+/*exported _GpfStreamReadableString*/ // gpf.stream.ReadableString%0A/*exported _GpfStreamWritableString*/ // gpf.stream.WritableString%0A
 /*#endif
@@ -586,25 +586,25 @@
 /%0A%0Avar%0A    _
-g
+G
 pfStreamRead
@@ -1530,17 +1530,17 @@
 */%0A    _
-g
+G
 pfStream
@@ -2587,33 +2587,33 @@
 llProgressFlag(_
-g
+G
 pfStreamReadable
@@ -2658,17 +2658,17 @@
 ssFlag(_
-g
+G
 pfStream

Simplify class access