PHP 클래스 yii\mongodb\file\StreamWrapper

Before feature can be used this wrapper should be registered via StreamWrapper::register method. It is usually performed via [[yii\mongodb\Connection::registerFileStreamWrapper()]]. Note: do not use this class directly - its instance will be created and maintained by PHP internally once corresponding stream resource is created. Resource path should be specified in following format: 'protocol://databaseName.fileCollectionPrefix?file_attribute=value' Write example: php $resource = fopen('gridfs://mydatabase.fs?filename=new_file.txt', 'w'); fwrite($resource, 'some content'); ... fclose($resource); Read example: php $resource = fopen('gridfs://mydatabase.fs?filename=my_file.txt', 'r'); $fileContent = stream_get_contents($resource);
또한 보기: http://php.net/manual/en/function.stream-wrapper-register.php
부터: 2.1
저자: Paul Klimov ([email protected])
상속: extends yii\base\Object
파일 보기 프로젝트 열기: yiisoft/yii2-mongodb

공개 프로퍼티들

프로퍼티 타입 설명
$context associated stream resource context. This property is set automatically by PHP once wrapper is instantiated.

공개 메소드들

메소드 설명
getContextOptions ( ) : array Returns options associated with [[context]].
register ( string $protocol = 'gridfs', boolean $force = false ) Registers this steam wrapper.
stream_close ( ) Closes a resource.
stream_eof ( ) : boolean Tests for end-of-file on a file pointer.
stream_flush ( ) : boolean This method is called in response to fflush() and when the stream is being closed while any unflushed data has been written to it before.
stream_open ( string $path, string $mode, integer $options, string &$openedPath ) : boolean Opens file.
stream_read ( integer $count ) : string | false Reads from stream.
stream_seek ( integer $offset, integer $whence = SEEK_SET ) : boolean Seeks to specific location in a stream.
stream_stat ( ) : array Retrieve information about a file resource.
stream_tell ( ) : integer Retrieve the current position of a stream.
stream_write ( string $data ) : integer Writes to stream.

비공개 메소드들

메소드 설명
fetchCollection ( ) : Collection Fetches associated file collection from stream options.
fileStatisticsTemplate ( ) : array Default template for file statistic data set.
parsePath ( string $path ) Parses stream open path, initializes internal parameters.
prepareDownload ( ) : boolean Prepares Download instance for the read operations.
prepareUpload ( ) : boolean Prepares Upload instance for the write operations.

메소드 상세

getContextOptions() 공개 메소드

Returns options associated with [[context]].
public getContextOptions ( ) : array
리턴 array context options.

register() 공개 정적인 메소드

Registers this steam wrapper.
public static register ( string $protocol = 'gridfs', boolean $force = false )
$protocol string name of the protocol to be used.
$force boolean whether to register wrapper, even if protocol is already taken.

stream_close() 공개 메소드

This method is called in response to fclose().
또한 보기: fclose()
public stream_close ( )

stream_eof() 공개 메소드

This method is called in response to feof().
또한 보기: feof()
public stream_eof ( ) : boolean
리턴 boolean `true` if the read/write position is at the end of the stream and if no more data is available to be read, or `false` otherwise.

stream_flush() 공개 메소드

This method is called in response to fflush() and when the stream is being closed while any unflushed data has been written to it before.
또한 보기: fflush()
public stream_flush ( ) : boolean
리턴 boolean whether cached data was successfully stored.

stream_open() 공개 메소드

This method is called immediately after the wrapper is initialized (f.e. by fopen() and file_get_contents()).
또한 보기: fopen()
public stream_open ( string $path, string $mode, integer $options, string &$openedPath ) : boolean
$path string specifies the URL that was passed to the original function.
$mode string mode used to open the file, as detailed for `fopen()`.
$options integer additional flags set by the streams API.
$openedPath string real opened path.
리턴 boolean whether operation is successful.

stream_read() 공개 메소드

This method is called in response to fread() and fgets().
또한 보기: fread()
public stream_read ( integer $count ) : string | false
$count integer count of bytes of data from the current position should be returned.
리턴 string | false if there are less than count bytes available, return as many as are available. If no more data is available, return `false`.

stream_seek() 공개 메소드

This method is called in response to fseek().
또한 보기: fseek()
public stream_seek ( integer $offset, integer $whence = SEEK_SET ) : boolean
$offset integer The stream offset to seek to.
$whence integer Possible values: - SEEK_SET - Set position equal to offset bytes. - SEEK_CUR - Set position to current location plus offset. - SEEK_END - Set position to end-of-file plus offset.
리턴 boolean Return true if the position was updated, false otherwise.

stream_stat() 공개 메소드

This method is called in response to stat().
또한 보기: stat()
public stream_stat ( ) : array
리턴 array file statistic information.

stream_tell() 공개 메소드

This method is called in response to fseek() to determine the current position.
또한 보기: fseek()
public stream_tell ( ) : integer
리턴 integer Should return the current position of the stream.

stream_write() 공개 메소드

This method is called in response to fwrite().
또한 보기: fwrite()
public stream_write ( string $data ) : integer
$data string string to be stored into the underlying stream.
리턴 integer the number of bytes that were successfully stored.

프로퍼티 상세

$context 공개적으로 프로퍼티

associated stream resource context. This property is set automatically by PHP once wrapper is instantiated.
public $context