AbstractFilterableInputStream
in package
implements
InputInterface, FilterableInterface
Abstract filterable input stream class
Tags
Table of Contents
Interfaces
- InputInterface
- Input byte stream interface
- FilterableInterface
- Filterable interface
Properties
- $sequence : int
- Write sequence
- $filters : array<string|int, mixed>
- StreamFilters
- $mirrors : array<string|int, mixed>
- Bound streams
- $writeBuffer : string
- A buffer for writing
Methods
- 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.
- removeFilter() : void
- Remove an already present StreamFilter based on its $key
- unbind() : void
- Remove an already bound stream.
- write() : mixed
- Writes $bytes to the end of the stream
- commitBytes() : int
- Commit the given bytes to the storage medium immediately
- flush() : void
- Flush any buffers/content with immediate effect
- doWrite() : void
- Just write the bytes to the stream
- filter() : mixed
- Run $bytes through all filters
Properties
$sequence
Write sequence
protected
int
$sequence
= 0
$filters
StreamFilters
private
array<string|int, mixed>
$filters
= []
$mirrors
Bound streams
private
array<string|int, mixed>
$mirrors
= []
$writeBuffer
A buffer for writing
private
string
$writeBuffer
= ''
Methods
addFilter()
Add a StreamFilter to this InputByteStream
public
addFilter(FilterInterface $filter, string $key) : void
Parameters
- $filter : FilterInterface
- $key : string
bind()
Attach $is to this stream.
public
bind(InputInterface $is) : void
The stream acts as an observer, receiving all data that is written. All and operations will be mirrored.
Parameters
- $is : InputInterface
commit()
For any bytes that are currently buffered inside the stream, force them off the buffer
public
commit() : void
flushBuffers()
Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
public
flushBuffers() : void
removeFilter()
Remove an already present StreamFilter based on its $key
public
removeFilter(string $key) : void
Parameters
- $key : string
unbind()
Remove an already bound stream.
public
unbind(InputInterface $is) : void
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
write()
Writes $bytes to the end of the stream
public
write(string $bytes) : mixed
Parameters
- $bytes : string
commitBytes()
Commit the given bytes to the storage medium immediately
protected
abstract commitBytes(string $bytes) : int
Parameters
- $bytes : string
Return values
intflush()
Flush any buffers/content with immediate effect
protected
abstract flush() : void
doWrite()
Just write the bytes to the stream
private
doWrite(int|string $bytes) : void
Parameters
- $bytes : int|string
filter()
Run $bytes through all filters
private
filter(int|string $bytes) : mixed
Parameters
- $bytes : int|string