>> YANA 4 PHP Framework >> Docs For Class SecureInputStream

Class SecureInputStream

Description

checked reading of file sources

This class adds functionality to compute the checksum of a resource and failsafe reading of resources.

  • access: public

Located in /includes/class_secureinputstream.php

Object
   |
   --InputStream
      |
      --SecureInputStream
Method Summary

Direct descendents

Class Description
SecureFileStream 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: InputStream::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 = SecureInputStream::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 SecureInputStream or a derived sub-class).

Note: This function has been renamed in version 2.9 RC3 from "SecureInputStream::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 SecureInputStream::getMd5() instead.

return file contents as string
string getFileContent ()
Description:
  • access: public

Redefined in descendants as:
return md5 hash for this file
string getMd5 (
[ $filename = ""]
)
List of parameters:
Name Type Description
$filename
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 = SecureInputStream::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 SecureInputStream 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 "SecureInputStream::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 SecureInputStream::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

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 InputStream

Inherited From Object

Documentation generated on Sun, 11 Mar 2007 15:02:43 +0100 by phpDocumentor 1.3.1

yana author: Thomas MeyerHomepage: www.yanaframework.net