Temporary
extends File
in package
Class \Hoa\File\Temporary.
Temporary file handler.
Tags
Table of Contents
Properties
- $_i : int
- Temporary file index.
Methods
- __construct() : mixed
- Open a temporary file.
- create() : string
- Create a unique temporary file, i.e. a file with a unique filename. It is different of calling $this->__construct() that will create a temporary file that will be destroy when calling the $this->close() method.
- getTemporaryDirectory() : string
- Get the directory path used for temporary files.
- _open() : resource
- Open the stream and return the associated resource.
Properties
$_i
Temporary file index.
private
static int
$_i
= 0
Methods
__construct()
Open a temporary file.
public
__construct(string $streamName, string $mode[, string $context = null ][, bool $wait = false ]) : mixed
Parameters
- $streamName : string
-
Stream name (or file descriptor).
- $mode : string
-
Open mode, see the parent::MODE_* constants.
- $context : string = null
-
Context ID (please, see the \Hoa\Stream\Context class).
- $wait : bool = false
-
Differ opening or not.
create()
Create a unique temporary file, i.e. a file with a unique filename. It is different of calling $this->__construct() that will create a temporary file that will be destroy when calling the $this->close() method.
public
static create([string $directory = null ][, string $prefix = '__hoa_' ]) : string
Parameters
- $directory : string = null
-
Directory where the temporary filename will be created. If the directory does not exist, it may generate a file in the system's temporary directory.
- $prefix : string = '__hoa_'
-
Prefix of the generated temporary filename.
Return values
stringgetTemporaryDirectory()
Get the directory path used for temporary files.
public
static getTemporaryDirectory() : string
Return values
string_open()
Open the stream and return the associated resource.
protected
& _open(string $streamName[, Context $context = null ]) : resource
Parameters
- $streamName : string
-
Stream name (here, it is null).
- $context : Context = null
-
Context.