Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • ArrayHash
  • ArrayList
  • Arrays
  • Callback
  • DateTime
  • FileSystem
  • Finder
  • Html
  • Image
  • Json
  • ObjectHelpers
  • ObjectMixin
  • Paginator
  • Random
  • Reflection
  • SafeStream
  • Strings
  • TokenIterator
  • Tokenizer
  • Validators

Interfaces

  • IHtmlString

Exceptions

  • AssertionException
  • ImageException
  • JsonException
  • RegexpException
  • TokenizerException
  • UnknownImageFileException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases

Class SafeStream

Provides atomicity and isolation for thread safe file manipulation using stream nette.safe://

file_put_contents('nette.safe://myfile.txt', $content);

$content = file_get_contents('nette.safe://myfile.txt');

unlink('nette.safe://myfile.txt');
Namespace: Nette\Utils
Internal
Located at SafeStream/SafeStream.php
Methods summary
public static boolean
# register( )

Registers protocol 'nette.safe://'.

Registers protocol 'nette.safe://'.

Returns

boolean
bool
public boolean
# stream_open( string $path, string $mode, integer $options )

Opens file.

Opens file.

Parameters

$path
name with stream protocol
$mode
- see fopen()
$options
STREAM_REPORT_ERRORS

Returns

boolean
true on success or false on failure
public
# stream_close( )

Closes file.

Closes file.

public string
# stream_read( integer $length )

Reads up to length bytes from the file.

Reads up to length bytes from the file.

Parameters

$length
length

Returns

string
string
public integer
# stream_write( string $data )

Writes the string to the file.

Writes the string to the file.

Parameters

$data
to write

Returns

integer
number of bytes that were successfully stored
public boolean
# stream_truncate( integer $size )

Truncates a file to a given length.

Truncates a file to a given length.

Parameters

$size
size to truncate to.

Returns

boolean
bool
public integer
# stream_tell( )

Returns the position of the file.

Returns the position of the file.

Returns

integer
int
public boolean
# stream_eof( )

Returns true if the file pointer is at end-of-file.

Returns true if the file pointer is at end-of-file.

Returns

boolean
bool
public integer
# stream_seek( integer $offset, integer $whence )

Sets the file position indicator for the file.

Sets the file position indicator for the file.

Parameters

$offset
position
$whence
fseek()

Returns

integer
Return true on success
public array
# stream_stat( )

Gets information about a file referenced by $this->tempHandle.

Gets information about a file referenced by $this->tempHandle.

Returns

array
array
public array
# url_stat( string $path, integer $flags )

Gets information about a file referenced by filename.

Gets information about a file referenced by filename.

Parameters

$path
name
$flags
STREAM_URL_STAT_QUIET

Returns

array
array
public boolean
# unlink( string $path )

Deletes a file. On Windows unlink is not allowed till file is opened

Deletes a file. On Windows unlink is not allowed till file is opened

Parameters

$path
name with stream protocol

Returns

boolean
true on success or false on failure
Constants summary
string PROTOCOL

Name of stream protocol - nette.safe://

Name of stream protocol - nette.safe://

#'nette.safe'
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0