Class MOXMAN_Vfs_Memory_FileStream
Inheritance | MOXMAN_Vfs_Memory_FileStream |
---|---|
Implements | MOXMAN_Vfs_IFileStream |
Memory file stream implementation. Instances of this class is created by the open method of the memory file.
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Constructs a new file stream instance for the specified file. | MOXMAN_Vfs_Memory_FileStream |
close() | Closes the specified stream. This will first flush the stream before closing. | MOXMAN_Vfs_Memory_FileStream |
flush() | Flush buffered data out to stream. | MOXMAN_Vfs_Memory_FileStream |
read() | Reads the specified number of bytes and returns an string with data. | MOXMAN_Vfs_Memory_FileStream |
readToEnd() | Reads all data avaliable in a stream and returns it as a string. | MOXMAN_Vfs_Memory_FileStream |
skip() | Skip/jump over specified number of bytes from stream. | MOXMAN_Vfs_Memory_FileStream |
write() | Writes a string to a stream. | MOXMAN_Vfs_Memory_FileStream |
Method Details
Constructs a new file stream instance for the specified file.
public void __construct ( MOXMAN_Vfs_Memory_File $file, $mode ) | ||
$file | MOXMAN_Vfs_Memory_File | File instance to create the stream for. |
$mode | string | File stream mode READ|WRITE. |
Closes the specified stream. This will first flush the stream before closing.
public void close ( ) |
Flush buffered data out to stream.
public void flush ( ) |
Reads the specified number of bytes and returns an string with data.
public string read ( $len = 1024 ) | ||
$len | int | Number of bytes to read, defaults to 1024. |
return | string | Data read from stream or null if it's at the end of stream. |
---|
Reads all data avaliable in a stream and returns it as a string.
public string readToEnd ( ) | ||
return | string | All data read from stream. |
---|
Skip/jump over specified number of bytes from stream.
public int skip ( $bytes ) | ||
$bytes | int | Number of bytes to skip. |
return | int | Number of skipped bytes. |
---|
Writes a string to a stream.
public void write ( $buff, $len = -1 ) | ||
$buff | string | String buffer to write to file. |
$len | int | Number of bytes from string to write. |