|
|
|
File: C:/usr/local/lib/php/blueshoes-4.2/core/file/Bs_File.class.php
BlueShoes Application Framework - file
Bs_File
Bs_Object | +-- Bs_FileSystem | +-- Bs_File
Represents a FILE (or a DIRECTORY?) as an Object
|
private class Bs_File extends Bs_FileSystem
Represents a FILE (or a DIRECTORY?) as an Object
Class File is an Object representation of a file OR directory.NOTE I : A directory is to be seen as a file; a special file, but still, a file.NOTE II: Some successful test were made on Windows(c) 2000 and it seams as ifbackslashes '\' in the path work as well as UNIX like forslashes '/'.ERGO: Use forslashes '/'. Because it then will work on both systems and '\' could beeasily misinterpreted as escape char.>> YES, windows will always understand '/' while unix doesn't accept '\'. --andrej
| Authors | , |
| Version | 4.0-$id$ |
| Copyright | blueshoes.org |
|
| |
|
Methods inherited from Bs_FileSystem |
| bs_filesystem, getfileattr, standardizepath, getcwd, getrealpath, realpath, getrealpathsplit, realpathsplit, setfullpath, getfullpath, getpathstem, getfilename, getfileextension, basename, isvalidfilename, isvalidpath, isvalidfullpath, islink, clearstatcache, move |
|
Methods inherited from Bs_Object |
| isex, isexception, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean |
|
|
|
|
|
|
|
Private Field Summary |
| string |
$_lastErrMsgholds the last occured error message. |
|
Private Constant Summary |
| BS_FILE_VERSION |
>>4.0.$x$<< |
Warning: documentation is missing. |
|
Public Method Details |
Bs_File |
|
public void Bs_File( [ string $fullPath ] )
|
| |
Constructor.
Fullpath may be of any format. E.g. dir, dir/, dir/file, ./dir/dir/file, ...NOTE: $fullPath should be a valid path to a file or dir. It will otherwise be ''.
|
| Parameter |
|
| string |
$fullPath |
= >>''<< |
|
. A valid path to a file or dir. |
|
| Returns |
void |
|
cp |
|
public void cp( )
|
| |
Copy the current file.
overloading used here, for details check _cp2() and _cp3().
|
| Returns |
void |
|
rm |
|
public bool rm( )
|
| |
removes this file (rm).
please don't add synonyms like remove(), delete(), unlink() etc.
|
| Returns |
bool |
|
readAll |
|
public string readAll( [ string $fullPath ] )
|
| |
reads everything from the file and returns it.
|
| Parameter |
|
| string |
$fullPath |
= >>NULL<< |
|
default is NULL. if used, this method is used static. |
|
| Returns |
string the whole file content. |
| Throws |
FALSE |
|
onewayWrite |
|
public bool onewayWrite( string $string, [ string $fullPath ] )
|
| |
writes $string to the file. if the file already exists all content will be overwritten.
if it doesn't exist it will be created.it's called oneway because the file is opened, the string is written, and then the fileis closed immediatly.
|
| Parameter |
|
| string |
$string |
|
|
the data you want to write to the file. |
|
|
| string |
$fullPath |
= >>NULL<< |
|
default is NULL. if used, this method is used static. |
|
| Returns |
bool true on success, false on failure. |
| See Also |
onewayAppend(), exclusiveWrite() |
|
onewayAppend |
|
public bool onewayAppend( string $string, [ string $fullPath ] )
|
| |
appends $string at the end of the file.
if it doesn't exist it will be created.it's called oneway because the file is opened, the string is written, and then the fileis closed immediatly.
|
| Parameter |
|
| string |
$string |
|
|
the data you want to write to the file. |
|
|
| string |
$fullPath |
= >>NULL<< |
|
default is NULL. if used, this method is used static. |
|
| Returns |
bool true on success, false on failure. |
| See Also |
onewayWrite(), exclusiveWrite() |
|
exclusiveWrite |
|
public bool exclusiveWrite( string $string, string $fullPath )
|
| |
Exclusive file write.
Try to get hold of a file exclusively and overwrite it with the passed data.
|
| Parameter |
|
| string |
$string |
|
|
the data you want to write to the file. |
|
|
| string |
$fullPath |
|
|
default is NULL. if used, this method is used static. |
|
| Returns |
bool TRUE on success, FALSE on failure (see getLastError()). |
| See Also |
onewayWrite(), onewayAppend() |
|
toString |
|
public string toString( string $cr )
|
| |
Dump file attributes as String
Warning: documentation is missing.
|
| Parameter |
|
| string |
$cr |
|
|
Warning: documentation is missing. |
|
| Returns |
string |
|
toHtml |
|
public void toHtml( )
|
| |
Dump file attributes as HTML String
Warning: documentation is missing.
|
| Returns |
void |
| See Also |
toString() |
|
getLastError |
|
public string getLastError( )
|
| |
returns the last occured error message.
|
| Returns |
string |
| See Also |
$_lastErrMsg |
|
|
Private Method Details |
_cp2 |
|
private mixed _cp2( string &$newFullPath, [ string $returnType ] )
|
| |
Copy the current file to $newFullPath.
this is an overloaded method for cp()
|
| Parameter |
|
|
|
| string |
$returnType |
= >>'bool'<< |
|
can be 'bool' or 'object'. bool: true=success|false=failure object: new instance of Bs_File on success, exception on failure. |
|
| Returns |
mixed (boolean or object depending on $returnType) |
| Throws |
mixed (false or exception depending on $returnType) |
|
_cp3 |
|
private mixed _cp3( string &$newFileName, [ string $newPath, string $returnType ] )
|
| |
Copy the current file to {$newPath}{$newFileName}
this is an overloaded method for cp()if $newPath is null, the new file gets placed into the same dir as the current one.
|
| Parameter |
|
|
|
| string |
$newPath |
= >>NULL,<< |
|
|
|
|
| string |
$returnType |
= >>'bool'<< |
|
can be 'bool' or 'object'. bool: true=success|false=failure object: new instance of Bs_File on success, exception on failure. |
|
| Returns |
mixed (boolean or object depending on $returnType) |
| Throws |
mixed (false or exception depending on $returnType) |
|
_write |
|
private void _write( string $string, string $fullPath, string $mode )
|
| |
internal write method.
|
| Parameter |
|
|
|
|
|
| string |
$mode |
|
|
(see http://www.php.net/manual/en/function.fopen.php) |
|
| Returns |
void |
| See Also |
onewayWrite(), onewayAppend() |
|
write |
|
private void write( $string )
|
| |
|
| Parameter |
|
|
$string |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
| See Also |
onewayWrite(), append(), onewayAppend() |
|
mv |
|
private void mv( )
|
| |
Warning: documentation is missing.
|
| Returns |
void |
|
create |
|
private void create( $fullPath )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
|
$fullPath |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
append |
|
private void append( $string )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
|
$string |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
|
Private Field Details |
$_lastErrMsg |
|
private string $_lastErrMsg
>>''<<
holds the last occured error message.
|
| See Also |
getLastError() |
|
|
Private Constant Details |
BS_FILE_VERSION
define( BS_FILE_VERSION, >>4.0.$x$<< )
Case: default: case sensitive
|
|
|
|
|
|
| PHPDoc 1.0beta |