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

Class DirStream

Description

Manipulate a directory

This class represents a directory. You may use this to get a list of contents, or remove, or create a directory.

  • access: public

Located in /includes/class_dirstream.php

Object
   |
   --InputStream
      |
      --DirStream
Method Summary

Methods

create this directory
bool create (
[int $mode = 777]
)
List of parameters:
Name Type Description
$mode int access mode
Description:

Tries to create the directory. Check the developer's cookbook for an example to this function.

  • name: DirStream::create()
  • access: public
  • uses: $DirStream->create(660)
remove this directory
boolean delete (
[boolean $is_recursive = false]
)
List of parameters:
Name Type Description
$is_recursive boolean triggers wether to remove directories even if they are not empty, default = false
Description:

By option you may choose to also recursivly remove all files and subdirectories inside. Otherwise the directory will only be removed if it is empty.

  • access: public
  • uses: $DirStream->delete(false)
list contents of a directory
array dirlist (
string $filter
)
List of parameters:
Name Type Description
$filter string
Description:

The argument $filter may contain multiple file extension, use a pipe '|' sign to seperate them. Example: "*.xml|*.html" will find all xml- and html-files

  • access: public
  • uses: $DirStream->dirlist('*.cfg')
check if directory exists and is readable
boolean exists ()
Description:
  • access: public

Redefinition of: InputStream::exists()

return list of files within the directory
array get ()
Description:

NOTE: will only return filenames with the path stripped

  • access: public
  • uses: $DirStream->get()

Redefinition of: InputStream::get()

check wether the directory has no contents
boolean isEmpty ()
Description:

Returns bool(true) if there are no files that match the current filter and bool(true) if there is at least 1 file that matches.

  • access: public
  • uses: $DirStream->isEmpty()
get the number of files inside the directory
int length ()
Description:

This returns a positive integer. Note that this functions counts the files in respect to the currently set file filter. So the number of files reported here and the number in total may vary.

  • access: public
  • uses: $DirStream->length()
read contents and put results in cache (filter settings will be applied)
boolean read ()
Description:
  • access: public
  • uses: $DirStream->read()
return a string representation of this directory
string toString ()
Description:

Returns a string with the contents of this directory

  • access: public
  • uses: $DirStream->toString()

Redefinition of: Object::toString()

inherited from base classes

Inherited From InputStream

Inherited From Object

Documentation generated on Wed, 22 Nov 2006 20:19:04 +0100 by phpDocumentor 1.3.1

yana author: Thomas MeyerHomepage: www.all-community.de/pub