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
4.0.0

Table of Contents

Interfaces

FileInterface
File stream interface

Properties

$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  : mixed
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  : mixed
A lazy-loaded resource handle for writing the file

Methods

__construct()  : mixed
Create a new FileByteStream for $path.
addFilter()  : void
Add a StreamFilter to this InputByteStream
bind()  : void
Attach $is to this stream.
commit()  : void
For any bytes that are currently buffered inside the stream, force them off the buffer
flushBuffers()  : void
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()  : void
Remove an already present StreamFilter based on its $key
setReadPointer()  : void
Move the internal read pointer to $byteOffset in the stream
unbind()  : void
Remove an already bound stream.
write()  : mixed
Writes $bytes to the end of the stream
commitBytes()  : int
Just write the bytes to the file
flush()  : void
Not used
copyReadStream()  : void
Copy a readOnly Stream to ensure seekability
doWrite()  : void
Just write the bytes to the stream
filter()  : mixed
Run $bytes through all filters
getReadHandle()  : mixed
Get the resource for reading
getReadStreamSeekableStatus()  : void
Check if ReadOnly Stream is seekable
getWriteHandle()  : mixed
Get the resource for writing
resetReadHandle()  : void
Force a reload of the resource for reading
seekReadStreamToPosition()  : void
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 mixed $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 mixed $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

flushBuffers()

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

public flushBuffers() : void

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|string $length) : string|bool

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

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

removeFilter()

Remove an already present StreamFilter based on its $key

public removeFilter(string $key) : void
Parameters
$key : string

setReadPointer()

Move the internal read pointer to $byteOffset in the stream

public setReadPointer(int|string $byteOffset) : void
Parameters
$byteOffset : int|string

commitBytes()

Just write the bytes to the file

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

copyReadStream()

Copy a readOnly Stream to ensure seekability

private copyReadStream() : void

getReadStreamSeekableStatus()

Check if ReadOnly Stream is seekable

private getReadStreamSeekableStatus() : void

resetReadHandle()

Force a reload of the resource for reading

private resetReadHandle() : void

seekReadStreamToPosition()

Streams in a readOnly stream ensuring copy if needed

private seekReadStreamToPosition(int|string $offset) : void
Parameters
$offset : int|string

        
On this page

Search results