C# Class 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().

Inheritance: IDisposable
Afficher le fichier Open project: iolevel/peachpie Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

Dispose() public méthode

Release wrapper resources
public Dispose ( ) : void
Résultat void

GetSystemWrapperSchemes() public static méthode

Gets the list of built-in stream wrapper schemes.
public static GetSystemWrapperSchemes ( ) : ICollection
Résultat ICollection

GetWrapper() public static méthode

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.
Résultat StreamWrapper

Listing() public méthode

public Listing ( string path, StreamListingOptions options, StreamContext context ) : string[]
path string
options StreamListingOptions
context StreamContext
Résultat string[]

MakeDirectory() public méthode

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
Résultat bool

OnClose() public méthode

Wrapper may be notified of closing a stream using this method.
public OnClose ( PhpStream stream ) : void
stream PhpStream
Résultat void

OnStat() public méthode

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.
Résultat Pchp.Core.PhpArray

Open() public abstract méthode

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
Résultat PhpStream

ParseMode() public méthode

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.
Résultat bool

RegisterSystemWrapper() public static méthode

Register a new system wrapper
public static RegisterSystemWrapper ( StreamWrapper wrapper ) : bool
wrapper StreamWrapper An instance of the corresponding StreamWrapper descendant.
Résultat bool

RemoveDirectory() public méthode

public RemoveDirectory ( string path, StreamRemoveDirectoryOptions options, StreamContext context ) : bool
path string
options StreamRemoveDirectoryOptions
context StreamContext
Résultat bool

Rename() public méthode

public Rename ( string fromPath, string toPath, StreamRenameOptions options, StreamContext context ) : bool
fromPath string
toPath string
options StreamRenameOptions
context StreamContext
Résultat bool

Stat() public méthode

public Stat ( string path, StreamStatOptions options, StreamContext context, bool streamStat ) : StatStruct
path string
options StreamStatOptions
context StreamContext
streamStat bool
Résultat StatStruct

Unlink() public méthode

StreamUnlinkOptions for the list of additional options.
public Unlink ( string path, StreamUnlinkOptions options, StreamContext context ) : bool
path string
options StreamUnlinkOptions
context StreamContext
Résultat bool