# FileUtils

File utility class.

- handles os independent stuff etc
- mapper stuff
- filter stuff

package | phing.util

### Methods

## contentEquals

    contentEquals(\PhingFile $file1, \PhingFile $file2) : boolean

### Arguments

#### $file1

`\PhingFile`

#### $file2

`\PhingFile`

### Response

`boolean`

Whether contents of two files is the same.

## Copies a file using filter chains.

    copyFile(\PhingFile $sourceFile, \PhingFile $destFile, boolean $overwrite = false, boolean $preserveLastModified = true, array &$filterChains = null, \Project $project, integer $mode = 493, boolean $preservePermissions = true) : void

throws |

### Arguments

#### $sourceFile

`\PhingFile`

#### $destFile

`\PhingFile`

#### $overwrite

`boolean`

#### $preserveLastModified

`boolean`

#### $filterChains

`array`

#### $project

`\Project`

#### $mode

`integer`

#### $preservePermissions

`boolean`

## Returns a new Reader with filterchains applied. If filterchains are empty, simply returns passed reader.

    getChainedReader(\Reader $in,  &$filterChains, \Project $project) : \Reader

static

### Arguments

#### $in

`\Reader`

Reader to modify (if appropriate).

#### $filterChains

``

#### $project

`\Project`

### Response

`\Reader`

Assembled Reader (w/ filter chains).

## Returns the default file/dir creation mask value (The mask value is prepared w.r.t the current user's file-creation mask value)

    getDefaultFileCreationMask(boolean $dirmode = false, boolean $returnoctal = false) : string

static

### Arguments

#### $dirmode

`boolean`

Directory creation mask to select

#### $returnoctal

`boolean`

Whether the return value is in octal representation

### Response

`string`

Creation Mask

## Normalize the given absolute path.

    normalize(string $path) : string

This includes:

- Uppercase the drive letter if there is one.
- Remove redundant slashes after the drive spec.
- resolve all ./, .\, ../ and ..\ sequences.
- DOS style paths that start with a drive letter will have \ as the separator.

throws |

### Arguments

#### $path

`string`

Path to normalize.

### Response

`string`

## Interpret the filename as a file relative to the given file - unless the filename already represents an absolute filename.

    resolveFile(\PhingFile $file, string $filename) : \PhingFile

throws |

### Arguments

#### $file

`\PhingFile`

the "reference" file for relative paths. This instance must be an absolute file and must not contain ./ or ../ sequences (same for \ instead of /).

#### $filename

`string`

a file name

### Response

`\PhingFile`

A PhingFile object pointing to an absolute file that doesn't contain ./ or ../ sequences and uses the correct separator for the current platform.