Copied!

GuzzleHttp\Psr7 stream decoder extension for charset conversion.

CloneableInstantiable
Methods
public __call(string $method, array $args)
 

Allow decorators to implement custom methods

public __construct(Psr\Http\Message\StreamInterface $stream, string $streamCharset = 'ISO-8859-1', string $stringCharset = 'UTF-8')
 
public __get(string $name)
 

Magic method used to create a new stream if streams are not added in
the constructor of a decorator (e.g., LazyOpenStream).

public __toString() : string
public close() : void
public detach()
public eof() : bool
 

Returns true if the end of stream has been reached.

public getContents() : string
public getMetadata( $key = NULL)
public getSize() : ?int
 

Returns null, getSize isn't supported

public isReadable() : bool
public isSeekable() : bool
 

Overridden to return false

public isWritable() : bool
public read( $length)
 

Reads up to $length decoded chars from the underlying stream and returns
them after converting to the target string charset.

public rewind() : void
public seek( $offset, $whence = 0ZBateson\StreamDecorators\SEEK_SET)
public tell() : int
 

Overridden to return the position in the target encoding.

public write( $string) : int
 

Writes the passed string to the underlying stream after converting it to
the target stream encoding.

Properties
protected $converter
 
protected $streamCharset
 
protected $stringCharset
 
Methods
protected createStream() : Psr\Http\Message\StreamInterface
 

Implement in subclasses to dynamically create streams when requested.

Properties
private $buffer
 
private $bufferLength
 
private $position
 
private $stream
Methods
private readRawCharsIntoBuffer(int $length) : void
 

Reads a minimum of $length characters from the underlying stream in its
encoding into $this->buffer.

Aligning to 4 bytes seemed to solve an issue reading from UTF-16LE
streams and pass testReadUtf16LeToEof, although the buffered string
should've solved that on its own.

© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration