Concatenate an array of streams into a single stream.
193406
function concatStreams(array) {
  var concat = new stream.PassThrough();

  function pipe(i) {
    if (i < array.length - 1) {
      array[i].pipe(concat, {end: false});
      array[i].on('end', function () { pipe(i + 1) });
    } else {
      array[i].pipe(concat);
    }
  }
  if (array.length > 0) {
    pipe(0);
  }

  return concat;
}
596763
function Stream( arr, options ) {
		if ( !Array.isArray( arr ) ) {
			throw new TypeError( 'Stream()::invalid input argument. First argument must be an array.' );
		}
		if ( arguments.length < 2 ) {
			options = {};
		}
		if ( !( this instanceof Stream ) ) {
			return new Stream( arr, options );
		}
		var err = validate( options );
		if ( err ) {
			throw err;
		}
		setOptions( options );
		Readable.call( this, options );
		this._array = arr.slice();
		this._destroyed = false;
		this._enc = options.encoding;
		this._mode = options.objectMode;
		return this;
	}
723197
function mergeArrays(objValue, srcValue) {
  if (isArray(objValue) && isArray(srcValue)) {
    return objValue.concat(srcValue)
  }
}
616678
public static <T> Stream<T> parallelConcatt(final Collection<? extends Iterator<? extends T>> c) {
        return parallelConcatt(c, DEFAULT_READING_THREAD_NUM);
    }
451111
public <T2> CoGroupedStreams<T, T2> coGroup(DataStream<T2> otherStream) {
		return new CoGroupedStreams<>(this, otherStream);
	}
730613
function concat(list, totalLength) {
  if (list.length === 0) return EMPTY_BUFFER;
  if (list.length === 1) return list[0];

  const target = Buffer.allocUnsafe(totalLength);
  let offset = 0;

  for (let i = 0; i < list.length; i++) {
    const buf = list[i];
    buf.copy(target, offset);
    offset += buf.length;
  }

  return target;
}
1201579
def StreamInChunks(self, callback=None, finish_callback=None,
                       additional_headers=None):
        """"""
        self.StreamMedia(callback=callback, finish_callback=finish_callback,
                         additional_headers=additional_headers,
                         use_chunks=True)
1000188
private static void concat(double[] target, double[] first, int firstLength, double[] second, int secondLength)
    {
        System.arraycopy(first, 0, target, 0, firstLength);
        System.arraycopy(second, 0, target, firstLength, secondLength);
    }
1282204
public static byte[] concat(final byte[]... arrays) {
    int len = 0;
    for (final byte[] arr : arrays) {
      len += arr.length;
    }

    final byte[] result = new byte[len];
    int pos = 0;
    for (final byte[] arr : arrays) {
      System.arraycopy(arr, 0, result, pos, arr.length);
      pos += arr.length;
    }
    return result;
  }
166690
def _MultiStream(cls, fds):
    """"""
    for fd in fds:
      fd.Seek(0)
      while True:
        chunk = fd.Read(cls.MULTI_STREAM_CHUNK_SIZE)
        if not chunk:
          break
        yield fd, chunk, None
723822
public static Stream<Float> box(final float[] floats) {
        return new FixedSizeStream<>(floats.length, new Func1<Integer, Float>() {
            @Override
            public Float call(Integer index) {
                return floats[index];
            }
        });
    }
604904
function flatten(array) {
        return array.reduce(function (a, b) {
            return isArray(b) ? a.concat(flatten(b)) : a.concat(b);
        }, []);
    }
46455
@SafeVarargs
	@SuppressWarnings("unchecked")
	public final PythonDataStream union(PythonDataStream... streams) {
		ArrayList<DataStream<PyObject>> dsList = new ArrayList<>();
		for (PythonDataStream ps : streams) {
			dsList.add(ps.stream);
		}
		DataStream<PyObject>[] dsArray = new DataStream[dsList.size()];
		return new PythonDataStream(stream.union(dsList.toArray(dsArray)));
	}
634985
def transform_streams_for_comparison(outputs):
    """"""
    new_outputs = []
    for output in outputs:
        if (output.output_type == 'stream'):
            # Transform output
            new_outputs.append({
                'output_type': 'stream',
                output.name: output.text,
            })
        else:
            new_outputs.append(output)
    return new_outputs
1268757
function readStream(stream) {
  return new Promise(function(resolve) {
    stream.pipe(concat(function(data) {
      resolve(data.toString().trim());
    }));
  });
}
989007
public static <T> Stream<T> buildConcatStream(List<T> sample1,
            List<T> sample2) {
        return Stream.concat(sample1.stream(), sample2.stream());
    }
317308
public static int[] concatArrays(int[] a, int[] b) {
        final int alen = a.length;
        final int blen = b.length;
        if (alen == 0) {
            return b;
        }
        if (blen == 0) {
            return a;
        }
        final int[] result = new int[alen + blen];
        arraycopy(a, 0, result, 0, alen);
        arraycopy(b, 0, result, alen, blen);
        return result;
    }