public static function pipe(StreamInterface $in, StreamInterface $out, $chunkSize = 8192)
	{
		if(!$in->isReadable())
		{
			throw new \InvalidArgumentException(sprintf('Input stream is not readable: %s', get_class($in)));
		}
		
		if(!$out->isWritable())
		{
			throw new \InvalidArgumentException(sprintf('Output stream is not writable: %s', get_class($out)));
		}
		
		$size = 0;
		
		while(!$in->eof())
		{
			$size += $out->write($in->read($chunkSize));
		}
		
		return $size;
	}