Class

eZ\Bundle\EzPublishIOBundle\BinaryStreamResponse

class BinaryStreamResponse extends Response

A modified version of HttpFoundation's BinaryFileResponse that accepts a stream as the input.

Methods

__construct(BinaryFile $binaryFile, IOServiceInterface $ioService, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoLastModified = true)

Constructor.

BinaryFileResponse setFile($file, $contentDisposition = null, $autoLastModified = true)

Sets the file to stream.

BinaryFile getFile()

Gets the file.

setAutoLastModified()

Automatically sets the Last-Modified header according the file modification date.

BinaryStreamResponse setContentDisposition(string $disposition, string $filename = '', string $filenameFallback = '')

Sets the Content-Disposition header with the given filename.

prepare(Request $request)

{@inheritdoc}

sendContent()

Sends the file.

setContent($content)

{@inheritdoc}

getContent()

Details

at line 50
public __construct(BinaryFile $binaryFile, IOServiceInterface $ioService, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoLastModified = true)

Constructor.

Parameters

BinaryFile $binaryFile
IOServiceInterface $ioService
$status
$headers
$public
$contentDisposition
$autoLastModified

at line 73
public BinaryFileResponse setFile($file, $contentDisposition = null, $autoLastModified = true)

Sets the file to stream.

Parameters

$file
$contentDisposition
$autoLastModified

Return Value

BinaryFileResponse

at line 93
public BinaryFile getFile()

Gets the file.

Return Value

BinaryFile The file to stream

at line 101
public setAutoLastModified()

Automatically sets the Last-Modified header according the file modification date.

at line 117
public BinaryStreamResponse setContentDisposition(string $disposition, string $filename = '', string $filenameFallback = '')

Sets the Content-Disposition header with the given filename.

Parameters

string $disposition ResponseHeaderBag::DISPOSITIONINLINE or ResponseHeaderBag::DISPOSITIONATTACHMENT
string $filename Optionally use this filename instead of the real name of the file
string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename

Return Value

BinaryStreamResponse

at line 136
public prepare(Request $request)

{@inheritdoc}

Parameters

Request $request

at line 196
public sendContent()

Sends the file.

at line 220
public setContent($content)

{@inheritdoc}

Parameters

$content

Exceptions

LogicException when the content is not null

at line 227
public getContent()