read file contents
bool
failSafeRead
()
Description:
Automatically restarts reading if the file-resource is temporarily not available after waiting for 0.5 seconds.
The process is aborted if it fails 3 times.
get file contents
string
get
()
Description:
return crc32 checksum for this file
int
getCrc32
(
[string $filename = ""]
)
List of parameters:
Name |
Type |
Description |
$filename |
string |
|
Description:
The filename parameter became available in version 2.8.5
This function has two synopsis. You may decide either to call it statically or based on a current instance.
- $md5 = FileReadonly::getMd5(string $filename)
- $md5 = $file->getMd5();
Both will return a MD5 hash. The first one for the file with the name you provided, the second for the file currently represented by the object $file (where $file is an instance of FileReadonly or a derived sub-class).
Note: This function has been renamed in version 2.9 RC3 from "FileReadonly::checksum", to better comply with the framework's naming convention
return file contents as string
string
getFileContent
()
Description:
Redefined in descendants as:
return md5 hash for this file
string
getMd5
(
[string $filename = ""]
)
List of parameters:
Name |
Type |
Description |
$filename |
string |
name of file (using current file if left blank) |
Description:
This function calculates and returns the MD5 hash-string for a file.
Usefull to check whether or not a file has been changed since last access.
This function has two synopsis. You may decide either to call it statically or based on a current instance.
- $md5 = FileReadonly::getMd5(string $filename)
- $md5 = $file->getMd5();
Both will return a MD5 hash. The first one for the file with the name you provided, the second for the file currently represented by the object $file (where $file is an instance of FileReadonly or a derived sub-class).
Note: results are cached for the current file.
Note: This function has been renamed in version 2.9 RC3 from "FileReadonly::md5Checksum", as the MD5 algorithm does not really return a checksum, but a hash value.
returns bool(true) if the source is empty or not loaded
bool
isEmpty
()
Description:
read file contents
bool
read
()
Description:
reload file contents
void
reset
()
Description:
You accidently did something wrong with the file? Calling this will reload the file from disk while reseting its current state.
Redefined in descendants as:
alias of get()
string
toString
()
Description:
inherited from base classes
Inherited From FileSystemResource
Inherited From Object