Hoa central
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Private Attributes | List of all members
Hoa\File\Temporary\Temporary Class Reference
Inheritance diagram for Hoa\File\Temporary\Temporary:

Public Member Functions

 __construct ($streamName, $mode, $context=null, $wait=false)
 
- Public Member Functions inherited from Hoa\File\File
 __construct ($streamName, $mode, $context=null, $wait=false)
 
 newBuffer ($callable=null, $size=null)
 
 flush ()
 
 deleteBuffer ()
 
 getBufferLevel ()
 
 getBufferSize ()
 
 lock ($operation)
 
 rewind ()
 
 seek ($offset, $whence=Stream\IStream\Pointable::SEEK_SET)
 
 tell ()
 
- Public Member Functions inherited from Hoa\File\Generic
 getBasename ()
 
 getDirname ()
 
 getSize ()
 
 getStatistic ()
 
 getATime ()
 
 getCTime ()
 
 getMTime ()
 
 getGroup ()
 
 getOwner ()
 
 getPermissions ()
 
 getReadablePermissions ()
 
 isReadable ()
 
 isWritable ()
 
 isExecutable ()
 
 clearStatisticCache ()
 
 touch ($time=-1, $atime=-1)
 
 copy ($to, $force=Stream\IStream\Touchable::DO_NOT_OVERWRITE)
 
 move ($name, $force=Stream\IStream\Touchable::DO_NOT_OVERWRITE, $mkdir=Stream\IStream\Touchable::DO_NOT_MAKE_DIRECTORY)
 
 delete ()
 
 changeGroup ($group)
 
 changeMode ($mode)
 
 changeOwner ($user)
 
 isFile ()
 
 isLink ()
 
 isDirectory ()
 
 isSocket ()
 
 isFIFOPipe ()
 
 isCharacterSpecial ()
 
 isBlockSpecial ()
 
 isUnknown ()
 
 getMode ()
 
 getINode ()
 
 getRealPath ()
 
 getExtension ()
 
 getFilename ()
 
- Public Member Functions inherited from Hoa\Stream\Stream
 __construct ($streamName, $context=null, $wait=false)
 
 open ()
 
 close ()
 
 getStreamName ()
 
 getStreamContext ()
 
 _setStream ($stream)
 
 isOpened ()
 
 setStreamTimeout ($seconds, $microseconds=0)
 
 setStreamBlocking ($mode)
 
 setStreamBuffer ($buffer)
 
 disableStreamBuffer ()
 
 getStreamBufferSize ()
 
 getStreamWrapperName ()
 
 getStreamMetaData ()
 
 isBorrowing ()
 
 on ($listenerId, $callable)
 
 _notify ($ncode, $severity, $message, $code, $transferred, $max)
 
 __toString ()
 
 __destruct ()
 

Static Public Member Functions

static create ($directory=null, $prefix= '__hoa_')
 
static getTemporaryDirectory ()
 
- Static Public Member Functions inherited from Hoa\File\File
static create ($name, $dummy)
 
- Static Public Member Functions inherited from Hoa\File\Generic
static clearAllStatisticCaches ()
 
static umask ($umask=null)
 
static isCaseSensitive ()
 
- Static Public Member Functions inherited from Hoa\Stream\Stream
static getStreamHandler ($streamName)
 
static _Hoa_Stream ()
 

Protected Member Functions

_open ($streamName,\Hoa\Stream\Context $context=null)
 
- Protected Member Functions inherited from Hoa\File\File
_open ($streamName, Stream\Context $context=null)
 
 _close ()
 
- Protected Member Functions inherited from Hoa\File\Generic
 setMode ($mode)
 
- Protected Member Functions inherited from Hoa\Stream\Stream
_open ($streamName, Context $context=null)
 
 _close ()
 
 getStream ()
 

Static Private Attributes

static $_i = 0
 

Additional Inherited Members

- Public Attributes inherited from Hoa\File\File
const MODE_READ = 'rb'
 
const MODE_READ_WRITE = 'r+b'
 
const MODE_TRUNCATE_WRITE = 'wb'
 
const MODE_TRUNCATE_READ_WRITE = 'w+b'
 
const MODE_APPEND_WRITE = 'ab'
 
const MODE_APPEND_READ_WRITE = 'a+b'
 
const MODE_CREATE_WRITE = 'xb'
 
const MODE_CREATE_READ_WRITE = 'x+b'
 
- Public Attributes inherited from Hoa\Stream\Stream
const NAME = 0
 
const HANDLER = 1
 
const RESOURCE = 2
 
const CONTEXT = 3
 
- Public Attributes inherited from Hoa\Stream\IStream\Statable
const SIZE_UNDEFINED = -1
 
- Public Attributes inherited from Hoa\Stream\IStream\Touchable
const OVERWRITE = true
 
const DO_NOT_OVERWRITE = false
 
const MAKE_DIRECTORY = true
 
const DO_NOT_MAKE_DIRECTORY = false
 
- Public Attributes inherited from Hoa\Stream\IStream\Lockable
const LOCK_SHARED = LOCK_SH
 
const LOCK_EXCLUSIVE = LOCK_EX
 
const LOCK_RELEASE = LOCK_UN
 
const LOCK_NO_BLOCK = LOCK_NB
 
- Public Attributes inherited from Hoa\Stream\IStream\Pointable
const SEEK_SET = SEEK_SET
 
const SEEK_CURRENT = SEEK_CUR
 
const SEEK_END = SEEK_END
 
- Protected Attributes inherited from Hoa\File\Generic
 $_mode = null
 
- Protected Attributes inherited from Hoa\Stream\Stream
 $_bucket = []
 
 $_bufferSize = 8192
 
 $_streamName = null
 
 $_context = null
 
 $_hasBeenDiffered = false
 
 $_on = null
 
 $_borrowed = false
 

Detailed Description

Class .

Temporary file handler.

Definition at line 50 of file Temporary.php.

Constructor & Destructor Documentation

Hoa\File\Temporary\Temporary::__construct (   $streamName,
  $mode,
  $context = null,
  $wait = false 
)

Open a temporary file.

Parameters
string$streamNameStream name (or file descriptor).
string$modeOpen mode, see the parent::MODE_* constants.
string$contextContext ID (please, see the class).
bool$waitDiffer opening or not.
Returns
void

Definition at line 72 of file Temporary.php.

77  {
78  if (null === $streamName) {
79  $streamName = 'hoa://Library/File/Temporary.php#' . self::$_i++;
80  }
81 
82  parent::__construct($streamName, $mode, $context, $wait);
83 
84  return;
85  }

Member Function Documentation

& Hoa\File\Temporary\Temporary::_open (   $streamName,
\Hoa\Stream\Context  $context = null 
)
protected

Open the stream and return the associated resource.

Parameters
string$streamNameStream name (here, it is null).
\Hoa\Stream\Context$contextContext.
Returns
resource
Exceptions

Definition at line 96 of file Temporary.php.

97  {
98  if (false === $out = @tmpfile()) {
99  throw new File\Exception(
100  'Failed to open a temporary stream.',
101  0
102  );
103  }
104 
105  return $out;
106  }
static Hoa\File\Temporary\Temporary::create (   $directory = null,
  $prefix = '__hoa_' 
)
static

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.

Parameters
string$directoryDirectory where the temporary filename will be created. If the directory does not exist, it may generate a file in the system's temporary directory.
string$prefixPrefix of the generated temporary filename.
Returns
string

Definition at line 121 of file Temporary.php.

122  {
123  if (null === $directory ||
124  false === is_dir($directory)) {
125  $directory = static::getTemporaryDirectory();
126  }
127 
128  return tempnam($directory, $prefix);
129  }
static Hoa\File\Temporary\Temporary::getTemporaryDirectory ( )
static

Get the directory path used for temporary files.

Returns
string

Definition at line 136 of file Temporary.php.

137  {
138  return sys_get_temp_dir();
139  }

Member Data Documentation

Hoa\File\Temporary\Temporary::$_i = 0
staticprivate

Definition at line 57 of file Temporary.php.


The documentation for this class was generated from the following file: