@private
@description
Writes all the collected data to the stream.

@param {Stream} stream - The stream to write to.
@returns {undefined}
767636
function flushCache(stream) {
    lastWrite = Date.now();

    if (timeout) {
      clearTimeout(timeout);
      timeout = null;
    }

    stream.push(cache.splice(0, settings.count || cache.length));
  }
34983
function sink( stream, clbk ) {
		var actual = [];
		stream.on( 'data', function onData( data ) {
			actual.push( data );
		});
		stream.once( 'end', function onEnd() {
			clbk( null, actual );
		});
		stream.once( 'error', function onError( error ) {
			clbk( error );
		});
	}
418540
function stringToStream(string) {
    let s = new stream.Readable();
    s.push(string);
    s.push(null);
    return s;
}
830202
function RelayStream(option) {
    Stream.apply(this, arguments);
    this.writable = true;
    this.readable = true;

    this.store = [];
    this.paused = !!option.paused;
    this.closed = false;
  }
521360
function stream (input, value) {
  value.on('data', data => input.push(data))
  value.on('error', err => error(input, err))
  value.on('end', () => input.push(null))
}
201356
protected void writeToSerializedStream(ObjectOutputStream stream) throws IOException {
        stream.writeLong(cas);
        stream.writeInt(expiry);
        stream.writeUTF(id);
        stream.writeObject(content);
        stream.writeObject(mutationToken);
    }
862974
function send(stream) {
      res.setHeader('content-type', mimetype);

      if (config.setCacheControl && !isNaN(config.maxAge)) {
        res.setHeader('Cache-Control', `public, max-age=${Math.floor(config.maxAge / 1000)}`)
      }

      if (config.beforeSend === 'function') {
        config.beforeSend(res, stream);
      }
      
      stream2buffer(stream, (err, buffer) => {
        if (err) {
          // faild to convert to buffer so lets just stream it.
          res.status(500).send('Internal Server Error');
          return;
        }
        
        const eTag = etag(buffer);
        const headers = req.headers;
        
        if (headers['if-none-match'] && headers['if-none-match'].replace('"', '') === eTag) {
          res.status(304);
          res.setHeader('ETag', eTag);
          res.setHeader('Content-Length', 0);
          res.end();
          return;
        }
        
        res.setHeader('ETag', eTag);

        res.send(buffer);
      });
    }
360012
function Stream(i) {
	this.offset = 0;
	if (i instanceof Buffer) {
		this.buffer = i;
	}
	else {
		this.buffer = new Buffer(i || 8192);
	}
}
247341
public void writeObject(@NonNull ObjectOutputStream stream) throws IOException {
        stream.writeObject(id);
        stream.writeLong(createdTime);
        stream.writeLong(lastAccessedTime);
        stream.writeInt(maxInactiveInterval);
        stream.writeBoolean(isNew);
        stream.writeBoolean(isValid);
        stream.writeInt(mAttributes.size());
        String keys[] = mAttributes.keySet().toArray(EMPTY_ARRAY);
        for (String key : keys) {
            Object value = mAttributes.get(key);
            if (value != null && value instanceof Serializable) {
                stream.writeObject(key);
                stream.writeObject(value);
            }
        }
    }
374577
function depsStream(deps) {
    var s = new stream.PassThrough({ objectMode: true });
    Rx.Node.writeToStream(deps, s);

    return function () {
        return s;
    };
}
107511
public void writeState(DataOutputStream stream) throws IOException
        {
        int len = mt.length;
        for(int x=0;x<len;x++) stream.writeInt(mt[x]);
        
        len = mag01.length;
        for(int x=0;x<len;x++) stream.writeInt(mag01[x]);
        
        stream.writeInt(mti);
        stream.writeDouble(__nextNextGaussian);
        stream.writeBoolean(__haveNextNextGaussian);
        }
322424
function Logger_write() {
            var log = this.logs.shift();

            if (log && (this.config.type === log.type || this.config.type === 'ALL')) {
                if (this.config.console) {
                    if (log.type === 'ERROR') {
                        exec_console(console.error, log, this.config.streamFormat);
                    } else if (log.type === 'INFO') {
                        exec_console(console.info, log, this.config.streamFormat);
                    } else if (log.type === 'WARNING') {
                        exec_console(console.warn, log, this.config.streamFormat);
                    } else {
                        exec_console(console.log, log, this.config.streamFormat);
                    }
                }

                if (this.stream) {
                    if (this.config.streamFormat === 'json') {
                        this.stream.write(JSON.stringify(log));
                        this.stream.write('\n');
                    } else {
                        this.stream.write('TYPE: ' + log.type);
                        this.stream.write('\n');
                        this.stream.write('CREATED: ' + log.created + '\t ');
                        this.stream.write('\n');
                        this.stream.write('MESSAGE: ' + log.message + '\t ' + log.trace);
                        this.stream.write('\n');
                        this.stream.write('DATA: ' + this.clean(log.data));
                        this.stream.write('\n');
                        this.stream.write('\n');
                    }
                }
                // clean log data for hook
                log.data = this.clean(log.data);
                // call log
                this.hooks.forEach(function (callback) {
                    callback(log);
                });
            }
            /**
             * Exec console output
             * @param func
             * @param log
             */
            function exec_console(func, log, format) {
                if (format === 'json') {
                    func(JSON.stringify(log));
                } else {
                    func(
                        ' ' + log.type + '\n',
                        'CREATED: ' + log.created + '\t ' + '\n',
                        'MESSAGE: ' + log.message + '\t ' + log.trace + '\n',
                        !!log.data ? 'DATA:' + log.data + '\n' : '',
                        '\n'
                    );
                }
            };
        }
540942
function Stream( value, options ) {
		if ( !arguments.length ) {
			throw new Error( 'Stream()::insufficient input arguments. Must provide a value to append.' );
		}
		if ( arguments.length < 2 ) {
			options = {};
		}
		if ( !( this instanceof Stream ) ) {
			return new Stream( value, options );
		}
		var err = validate( options );
		if ( err ) {
			throw err;
		}

		Transform.call( this, options );
		this._val = value.toString();
		this._destroyed = false;

		return this;
	}
553636
function () {
    var write = function (node, enc, cb) {
      node.value = encoder.encode(node.value, dag.valueEncoding)
      stream.node(node, cb)
    }

    stream.emit('live')
    pipe(dag.createReadStream({since: changes, live: true}), through.obj(write))
  }
617525
function(data, encoding, callback) {
    if (this.error) {
      if (callback) {
        callback(error);
      }
      throw error;
    } else {
      return this.stream.write(data, encoding, callback);
    }
  }
1301557
function createStream (options) {
        options = options || {}

        var stream = through2.obj(function transform (chunk, encoding, cb) {
            stream.push(options.objectMode ? chunk : JSON.stringify(chunk)+'\n')
            cb()
        })
        stream.close = function close () {
            setImmediate(function () {
                stream.push(null)
                changes.unpipe(stream)
            })
            numStreams--
        }
        changes.pipe(stream)
        numStreams++
        return stream
    }
664514
function (stream) {
        var self = this;
        stream.on('data', function (chunk) {
            self.push(chunk);
        });
        stream.on('end', function () {
            self.push(null);
        });
        this.readableUnit = stream;
        return this;
    }