Documentation

FileByteStream extends AbstractFilterableInputStream
in package
implements FileInterface

File byte stream class

Tags
category

Pop

author

Chris Corbyn, from the SwiftMailer library https://github.com/swiftmailer/swiftmailer

version
3.6.0

Interfaces, Classes, Traits and Enums

FileInterface
File stream interface

Table of Contents

$sequence  : int
Write sequence
$filters  : array<string|int, mixed>
StreamFilters
$mirrors  : array<string|int, mixed>
Bound streams
$mode  : string
The mode this file is opened in for writing
$offset  : int
The internal pointer offset
$path  : string
The path to the file
$reader  : resource
A lazy-loaded resource handle for reading the file
$seekable  : mixed
If stream is seekable true/false, or null if not known
$writeBuffer  : string
A buffer for writing
$writer  : resource
A lazy-loaded resource handle for writing the file
__construct()  : mixed
Create a new FileByteStream for $path.
addFilter()  : mixed
Add a StreamFilter to this InputByteStream
bind()  : mixed
Attach $is to this stream.
commit()  : mixed
For any bytes that are currently buffered inside the stream, force them off the buffer
flushBuffers()  : mixed
Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
getPath()  : string
Get the complete path to the file
read()  : string|bool
Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.
removeFilter()  : mixed
Remove an already present StreamFilter based on its $key
setReadPointer()  : bool
Move the internal read pointer to $byteOffset in the stream
unbind()  : mixed
Remove an already bound stream.
write()  : int
Writes $bytes to the end of the stream
commitBytes()  : mixed
Just write the bytes to the file
flush()  : mixed
Not used
copyReadStream()  : mixed
Copy a readOnly Stream to ensure seekability
doWrite()  : mixed
Just write the bytes to the stream
filter()  : int
Run $bytes through all filters
getReadHandle()  : resource
Get the resource for reading
getReadStreamSeekableStatus()  : mixed
Check if ReadOnly Stream is seekable
getWriteHandle()  : resource
Get the resource for writing
resetReadHandle()  : mixed
Force a reload of the resource for reading
seekReadStreamToPosition()  : mixed
Streams in a readOnly stream ensuring copy if needed

Properties

$mode

The mode this file is opened in for writing

private string $mode

$reader

A lazy-loaded resource handle for reading the file

private resource $reader

$seekable

If stream is seekable true/false, or null if not known

private mixed $seekable = null

$writer

A lazy-loaded resource handle for writing the file

private resource $writer

Methods

__construct()

Create a new FileByteStream for $path.

public __construct(string $path[, bool $writable = false ]) : mixed
Parameters
$path : string
$writable : bool = false

if true

Tags
throws
Exception
Return values
mixed

commit()

For any bytes that are currently buffered inside the stream, force them off the buffer

public commit() : mixed
Return values
mixed

flushBuffers()

Flush the contents of the stream (empty it) and set the internal pointer to the beginning.

public flushBuffers() : mixed
Return values
mixed

getPath()

Get the complete path to the file

public getPath() : string
Return values
string

read()

Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.

public read(int $length) : string|bool

If less bytes exist than are requested the remaining bytes are given instead. If no bytes are remaining at all, boolean false is returned.

Parameters
$length : int
Tags
throws
Exception
Return values
string|bool

removeFilter()

Remove an already present StreamFilter based on its $key

public removeFilter(string $key) : mixed
Parameters
$key : string
Return values
mixed

setReadPointer()

Move the internal read pointer to $byteOffset in the stream

public setReadPointer(int $byteOffset) : bool
Parameters
$byteOffset : int
Return values
bool

unbind()

Remove an already bound stream.

public unbind(InputInterface $is) : mixed

If $is is not bound, no errors will be raised. If the stream currently has any buffered data it will be written to $is before unbinding occurs.

Parameters
$is : InputInterface
Return values
mixed

write()

Writes $bytes to the end of the stream

public write(string $bytes) : int
Parameters
$bytes : string
Return values
int

commitBytes()

Just write the bytes to the file

protected commitBytes(string $bytes) : mixed
Parameters
$bytes : string
Return values
mixed

flush()

Not used

protected flush() : mixed
Return values
mixed

copyReadStream()

Copy a readOnly Stream to ensure seekability

private copyReadStream() : mixed
Return values
mixed

doWrite()

Just write the bytes to the stream

private doWrite(int $bytes) : mixed
Parameters
$bytes : int
Return values
mixed

getReadHandle()

Get the resource for reading

private getReadHandle() : resource
Tags
throws
Exception
Return values
resource

getReadStreamSeekableStatus()

Check if ReadOnly Stream is seekable

private getReadStreamSeekableStatus() : mixed
Return values
mixed

getWriteHandle()

Get the resource for writing

private getWriteHandle() : resource
Tags
throws
Exception
Return values
resource

resetReadHandle()

Force a reload of the resource for reading

private resetReadHandle() : mixed
Return values
mixed

seekReadStreamToPosition()

Streams in a readOnly stream ensuring copy if needed

private seekReadStreamToPosition(int $offset) : mixed
Parameters
$offset : int
Return values
mixed

Search results