StringBasedFileContent
extends SeekableFileContent
in package
implements
FileContent
Default implementation for file contents based on simple strings.
Tags
Interfaces, Classes and Traits
- FileContent
- Interface for actual file contents.
Table of Contents
- $content : mixed
- actual content
- $offset : mixed
- current position within content
- __construct() : mixed
- constructor
- bytesRead() : int
- for backwards compatibility with vfsStreamFile::bytesRead()
- content() : string
- returns actual content
- eof() : bool
- checks whether pointer is at end of file
- read() : string
- reads the given amount of bytes from content
- readUntilEnd() : string
- for backwards compatibility with vfsStreamFile::readUntilEnd()
- seek() : bool
- seeks to the given offset
- size() : int
- returns size of content
- truncate() : bool
- Truncates a file to a given length
- write() : int
- writes an amount of data
- doRead() : mixed
- actual reading of length starting at given offset
- doWrite() : mixed
- actual writing of data with specified length at given offset
Properties
$content
actual content
private
mixed
$content
Tags
$offset
current position within content
private
mixed
$offset
= 0
Tags
Methods
__construct()
constructor
public
__construct(string $content) : mixed
Parameters
- $content : string
Return values
mixed —bytesRead()
for backwards compatibility with vfsStreamFile::bytesRead()
public
bytesRead() : int
Tags
Return values
int —content()
returns actual content
public
content() : string
Return values
string —eof()
checks whether pointer is at end of file
public
eof() : bool
Return values
bool —read()
reads the given amount of bytes from content
public
read(int $count) : string
Parameters
- $count : int
Return values
string —readUntilEnd()
for backwards compatibility with vfsStreamFile::readUntilEnd()
public
readUntilEnd() : string
Tags
Return values
string —seek()
seeks to the given offset
public
seek(int $offset, int $whence) : bool
Parameters
- $offset : int
- $whence : int
Return values
bool —size()
returns size of content
public
size() : int
Return values
int —truncate()
Truncates a file to a given length
public
truncate(int $size) : bool
Parameters
- $size : int
-
length to truncate file to
Return values
bool —write()
writes an amount of data
public
write(string $data) : int
Parameters
- $data : string
Return values
int —amount of written bytes
doRead()
actual reading of length starting at given offset
protected
doRead(int $offset, int $count) : mixed
Parameters
- $offset : int
- $count : int
Return values
mixed —doWrite()
actual writing of data with specified length at given offset
protected
doWrite(string $data, int $offset, int $length) : mixed
Parameters
- $data : string
- $offset : int
- $length : int