yana

phpDocumentor v 1.4.0

Class FileReadonly

Description

checked reading of file sources
This class adds functionality to compute the checksum of a resource and failsafe reading of resources.
Note: This class does not implement methods for writing on files.
  • access: public
Object
   |
   --FileSystemResource
      |
      --FileReadonly
Method Summary

Direct descendents

Class Description
DbBlob read binary large objects (blobs) from database
File checked reading and writing of file sources
VDrive virtual Drive

Methods

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.
  • access: public
get file contents
string get ()
Description:
  • access: public

Redefinition of: FileSystemResource::get()


Redefined in descendants as:
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
If you prefer a hash value over a checksum, you may want to have a look at FileReadonly::getMd5() instead.
return file contents as string
string getFileContent ()
Description:
  • access: public

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.
If you prefer a checksum over a hash value, you may want to have a look at FileReadonly::getCrc32() instead.
returns bool(true) if the source is empty or not loaded
bool isEmpty ()
Description:
  • access: public
read file contents
bool read ()
Description:
Returns bool(true) on success and bool(false) on error.
  • access: public

Redefinition of: FileSystemResource::read()


Redefined in descendants as:
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.
  • access: public

Redefined in descendants as:
alias of get()
string toString ()
Description:
  • access: public

Redefinition of: Object::toString()


Redefined in descendants as:
inherited from base classes

Inherited From FileSystemResource

Inherited From Object

Documentation generated on Sat, 03 Jan 2009 22:22:24 +0100 by phpDocumentor 1.4.0

yana author: Thomas MeyerHomepage: www.yanaframework.net