MemoryWriter
in package
implements
Writer
A writer that copies the given byte string into an in-memory buffer and allows to get the written byte string from the buffer.
Interfaces, Classes, Traits and Enums
- Writer
- An interface to write a byte string (which can be quite long) in separated multiple chunks.
Table of Contents
- __construct() : void
- Creates a new {@see MemoryWriter} instance with an empty buffer.
- __toString() : mixed
- getBuffer() : string
- Gets the written contents from the buffer.
- getLength() : int
- Gets the total number of written bytes.
- write() : void
- Writes the given chunk of bytes.
Methods
__construct()
Creates a new {@see MemoryWriter} instance with an empty buffer.
public
__construct() : void
Return values
void —__toString()
public
__toString() : mixed
Return values
mixed —getBuffer()
Gets the written contents from the buffer.
public
getBuffer() : string
Return values
string —The byte string written into the buffer.
getLength()
Gets the total number of written bytes.
public
getLength() : int
Return values
int —The total number of written bytes.
write()
Writes the given chunk of bytes.
public
write(mixed $bytes) : void
Parameters
- $bytes : mixed
-
The byte string to write. This is usually a chunk of a longer byte string.