OpenMediaVault
0.6 (Kralizec)
The open network attached storage solution
|
Public Member Functions | |
__construct ($filename) | |
__destruct () | |
exists () | |
open ($accessMode="w+", $lockMode=LOCK_EX) | |
isOpen () | |
isEmpty () | |
close () | |
write ($content) | |
read ($decode=TRUE) | |
truncate ($size) | |
unlink () | |
![]() | |
__construct () | |
getLastError () | |
Additional Inherited Members | |
![]() | |
setLastError ($error) | |
debug () | |
Read and write JSON encoded content to a file. The file is locked when it is opened and the lock is removed when it is closed.
OMVJsonFile::__construct | ( | $filename | ) |
Constructor
filename | The name of the file. |
OMVJsonFile::__destruct | ( | ) |
Destructor
OMVJsonFile::close | ( | ) |
Close the file.
E_MISC_FAILURE |
OMVJsonFile::exists | ( | ) |
Checks whether the file exists.
OMVJsonFile::isEmpty | ( | ) |
Is the file empty?
OMVJsonFile::isOpen | ( | ) |
Is the file opened?
OMVJsonFile::open | ( | $accessMode = "w+" , |
|
$lockMode = LOCK_EX |
|||
) |
Open the file.
accessMode | The parameter specifies the type of access you require to the stream. Defaults to 'w+'. |
lockMode | The lock mode. Defaults to LOCK_EX. |
E_MISC_FAILURE |
OMVJsonFile::read | ( | $decode = TRUE | ) |
Read the JSON encoded data from the file.
decode | Set to TRUE to decode the JSON content. Defaults to TRUE. |
E_MISC_FAILURE |
OMVJsonFile::truncate | ( | $size | ) |
Truncates the file to a given length.
size | The size to truncate to. |
E_MISC_FAILURE |
OMVJsonFile::unlink | ( | ) |
Unlink the given file.
OMVJsonFile::write | ( | $content | ) |
Write the given content as JSON encoded string to the file. The file will be truncated to zero length before the content is written.
content | The content to be written. |
E_MISC_FAILURE |