YANA 4 PHP FrameworkDocs 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

    SerializeableObject
       |
       --InputStream
          |
          --DirStream

#### Method Summary

bool create ([int $mode = 777])
boolean delete ([boolean $is_recursive = false])
array dirlist (string $filter)
boolean exists ()
array get ()
boolean isEmpty ()
int length ()
boolean read ()
string toString ()

#### Methods

##### create

bool create ([int $mode = 777])

create this directory

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)

Name | Type | Description
--- | --- | ---
$mode | int | access mode

##### delete

boolean delete ([boolean $is_recursive = false])

remove this directory

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)

Name | Type | Description
--- | --- | ---
$is_recursive | boolean | triggers wether to remove directories even if they are not empty, default = false

##### dirlist

array dirlist (string $filter)

list contents of a directory

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')

Name | Type | Description
--- | --- | ---
$filter | string |

##### exists

boolean exists ()

check if directory exists and is readable

- access: public

Redefinition of:

InputStream::exists()
  exists

##### get

array get ()

return list of files within the directory

NOTE: will only return filenames with the path stripped

- access: public
- uses: $dirStream->get()

Redefinition of:

InputStream::get()
  get

##### isEmpty

boolean isEmpty ()

check wether the directory has no contents

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()

Redefinition of:

InputStream::isEmpty()
  «abstract» isEmpty

##### length

int length ()

length

- access: public
- uses: $dirStream->length()

##### read

boolean read ()

read contents and put results in cache (filter settings will be applied)

- access: public
- uses: $dirStream->read()

Redefinition of:

InputStream::read()
  «abstract» read

##### toString

string toString ()

toString

- access: public
- uses: $dirStream->toString()

Redefinition of:

InputStream::toString()
  «abstract» toString

#### Inherited Methods

Inherited From InputStream

> InputStream::InputStream()
> InputStream::exists()
> InputStream::get()
> InputStream::getFilename()
> InputStream::isEmpty()
> InputStream::read()
> InputStream::resetStats()
> InputStream::toString()

Inherited From SerializeableObject

> SerializeableObject::serialize()
> SerializeableObject::toString()

Documentation generated on Sat, 16 Sep 2006 17:05:57 +0200 by phpDocumentor 1.3.0RC4

yana author: Thomas Meyerwww.all-community.de/pub