C# Класс Pchp.Library.Streams.StreamWrapper

Abstract base class for PHP stream wrappers. Descendants define methods implementing fopen, stat, unlink, rename, opendir, mkdir and rmdir for different stream types.
Each script has its own copy of registeredWrappers stored in the context.

PhpStream is created by a StreamWrapper on a call to fopen(). Wrappers are stateless: they provide an instance of PhpStream on fopen() and an instance of DirectoryListing on opendir().

Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Dispose ( ) : void

Release wrapper resources

GetSystemWrapperSchemes ( ) : ICollection

Gets the list of built-in stream wrapper schemes.

GetWrapper ( Context ctx, string scheme, StreamOptions options ) : StreamWrapper

Retreive the corresponding StreamWrapper respectind the scheme portion of the given path. If no scheme is specified, an instance of FileStreamWrapper is returned.

Listing ( string path, StreamListingOptions options, StreamContext context ) : string[]
MakeDirectory ( string path, int accessMode, StreamMakeDirectoryOptions options, StreamContext context ) : bool StreamMakeDirectoryOptions for the list of additional options.
OnClose ( PhpStream stream ) : void

Wrapper may be notified of closing a stream using this method.

OnStat ( PhpStream stream ) : PhpArray

Wrapper may override the stat()ing of a stream using this method.

Open ( Context ctx, string &path, string mode, StreamOpenOptions options, StreamContext context ) : PhpStream
ParseMode ( string mode, StreamOpenOptions options, FileMode &fileMode, FileAccess &fileAccess, StreamAccessOptions &accessOptions ) : bool

Parse the mode argument passed to fopen() and make the appropriate FileMode and FileAccess combination. Integrate the relevant options from StreamOpenOptions too.

RegisterSystemWrapper ( StreamWrapper wrapper ) : bool

Register a new system wrapper

RemoveDirectory ( string path, StreamRemoveDirectoryOptions options, StreamContext context ) : bool
Rename ( string fromPath, string toPath, StreamRenameOptions options, StreamContext context ) : bool
Stat ( string path, StreamStatOptions options, StreamContext context, bool streamStat ) : StatStruct
Unlink ( string path, StreamUnlinkOptions options, StreamContext context ) : bool StreamUnlinkOptions for the list of additional options.

Приватные методы

Метод Описание
CheckOptions ( StreamAccessOptions accessOptions, FileAccess supportedAccess, string path ) : bool

Checks whether the supported read/write access matches the reqiured one.

GetWrapperInternal ( Context ctx, string scheme ) : StreamWrapper

Search the lists of registered StreamWrappers to find the appropriate wrapper for a given scheme. When the scheme is empty, the FileStreamWrapper is returned.

ParseMode ( string mode, StreamOpenOptions options, StreamAccessOptions &accessOptions ) : bool

Overload of ParseMode(string, StreamOpenOptions, out FileMode, out FileAccess, out StreamAccessOptions) without the out arguments.

StatUnsupported ( ) : StatStruct

Reports warning and creates invalid stat.

Описание методов

Dispose() публичный Метод

Release wrapper resources
public Dispose ( ) : void
Результат void

GetSystemWrapperSchemes() публичный статический Метод

Gets the list of built-in stream wrapper schemes.
public static GetSystemWrapperSchemes ( ) : ICollection
Результат ICollection

GetWrapper() публичный статический Метод

Retreive the corresponding StreamWrapper respectind the scheme portion of the given path. If no scheme is specified, an instance of FileStreamWrapper is returned.
In case when the required wrapper can not be found.
public static GetWrapper ( Context ctx, string scheme, StreamOptions options ) : StreamWrapper
ctx Pchp.Core.Context Current runtime context.
scheme string The scheme portion of an URL.
options StreamOptions Additional having effect on the wrapper retreival.
Результат StreamWrapper

Listing() публичный Метод

public Listing ( string path, StreamListingOptions options, StreamContext context ) : string[]
path string
options StreamListingOptions
context StreamContext
Результат string[]

MakeDirectory() публичный Метод

StreamMakeDirectoryOptions for the list of additional options.
public MakeDirectory ( string path, int accessMode, StreamMakeDirectoryOptions options, StreamContext context ) : bool
path string
accessMode int
options StreamMakeDirectoryOptions
context StreamContext
Результат bool

OnClose() публичный Метод

Wrapper may be notified of closing a stream using this method.
public OnClose ( PhpStream stream ) : void
stream PhpStream
Результат void

OnStat() публичный Метод

Wrapper may override the stat()ing of a stream using this method.
public OnStat ( PhpStream stream ) : PhpArray
stream PhpStream The Wrapper-opened stream to be stat()ed.
Результат Pchp.Core.PhpArray

Open() публичный абстрактный Метод

public abstract Open ( Context ctx, string &path, string mode, StreamOpenOptions options, StreamContext context ) : PhpStream
ctx Pchp.Core.Context
path string
mode string
options StreamOpenOptions
context StreamContext
Результат PhpStream

ParseMode() публичный Метод

Parse the mode argument passed to fopen() and make the appropriate FileMode and FileAccess combination. Integrate the relevant options from StreamOpenOptions too.
public ParseMode ( string mode, StreamOpenOptions options, FileMode &fileMode, FileAccess &fileAccess, StreamAccessOptions &accessOptions ) : bool
mode string Mode as passed to fopen().
options StreamOpenOptions The passed to fopen().
fileMode FileMode Resulting specifying opening mode.
fileAccess FileAccess Resulting specifying read/write access options.
accessOptions StreamAccessOptions Resulting giving /// additional information to the stream opener.
Результат bool

RegisterSystemWrapper() публичный статический Метод

Register a new system wrapper
public static RegisterSystemWrapper ( StreamWrapper wrapper ) : bool
wrapper StreamWrapper An instance of the corresponding StreamWrapper descendant.
Результат bool

RemoveDirectory() публичный Метод

public RemoveDirectory ( string path, StreamRemoveDirectoryOptions options, StreamContext context ) : bool
path string
options StreamRemoveDirectoryOptions
context StreamContext
Результат bool

Rename() публичный Метод

public Rename ( string fromPath, string toPath, StreamRenameOptions options, StreamContext context ) : bool
fromPath string
toPath string
options StreamRenameOptions
context StreamContext
Результат bool

Stat() публичный Метод

public Stat ( string path, StreamStatOptions options, StreamContext context, bool streamStat ) : StatStruct
path string
options StreamStatOptions
context StreamContext
streamStat bool
Результат StatStruct

Unlink() публичный Метод

StreamUnlinkOptions for the list of additional options.
public Unlink ( string path, StreamUnlinkOptions options, StreamContext context ) : bool
path string
options StreamUnlinkOptions
context StreamContext
Результат bool