downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

streamWrapper::__construct> <ストリームラッパーとして登録するクラスの例
Last updated: Fri, 13 Nov 2009

view this page in

streamWrapper クラス

導入

独自のプロトコルハンドラやストリームを実装し、 (fopen()fread() などの) 他のファイルシステム関数で使用できるようにします。

注意: これは、実際のクラスではありません。 クラスがどのようにプロトコルを定義すべきかを示す、単なるプロトタイプです。

注意: ここに示す方法以外でメソッドを実装した場合の挙動は未定義となります。

このクラスのインスタンスは、 関連付けられているプロトコルへのストリーム関数からのアクセスがあった時点で初期化されます。

クラス概要

streamWrapper
streamWrapper {
/* プロパティ */
public resource $context ;
/* メソッド */
__construct ( void )
public bool dir_closedir ( void )
public bool dir_opendir ( string $path , int $options )
public string dir_readdir ( void )
public bool dir_rewinddir ( void )
public bool mkdir ( string $path , int $mode , int $options )
public bool rename ( string $path_from , string $path_to )
public bool rmdir ( string $path , int $options )
public resource stream_cast ( int $cast_as )
public void stream_close ( void )
public bool stream_eof ( void )
public bool stream_flush ( void )
public bool stream_lock ( mode $operation )
public bool stream_open ( string $path , string $mode , int $options , string &$opened_path )
public string stream_read ( int $count )
public bool stream_seek ( int $offset , int $whence = SEEK_SET )
public bool stream_set_option ( int $option , int $arg1 , int $arg2 )
public array stream_stat ( void )
public int stream_tell ( void )
public int stream_write ( string $data )
public bool unlink ( string $path )
public array url_stat ( string $path , int $flags )
}

プロパティ

resource context

現在のコンテキスト、 あるいは呼び出し元からコンテキストが渡されていない場合は NULL

stream_context_get_options() を用いてコンテキストをパースします。

注意: このプロパティは必ず public とし、 PHP が実際のコンテキストリソースを設定できるようにしなければなりません。

変更履歴

バージョン 説明
5.0.0 context プロパティが追加されました。

目次



add a note add a note User Contributed Notes
streamWrapper
yannick dot battail at gmail dot com
17-Jul-2009 09:38
a php interface for wrapper

<?php
interface WrapperInterface
{
   
/**
     * resource context
     *
     * @var resource
     */
    //public $context;

    /**
     * constructor
     *
     */
   
public function __construct();

   
/**
     *
     *
     * @return bool
     */
   
public function dir_closedir();

   
/**
     * Enter description here...
     *
     * @param string $path
     * @param int $options
     * @return bool
     */
   
public function dir_opendir($path , $options);

   
/**
     * Enter description here...
     *
     * @return string
     */
   
public function dir_readdir();

   
/**
     * Enter description here...
     *
     * @return bool
     */
   
public function dir_rewinddir();

   
/**
     * Enter description here...
     *
     * @param string $path
     * @param int $mode
     * @param int $options
     * @return bool
     */
   
public function mkdir($path , $mode , $options);

   
/**
     * Enter description here...
     *
     * @param string $path_from
     * @param string $path_to
     * @return bool
     */
   
public function rename($path_from , $path_to);

   
/**
     * Enter description here...
     *
     * @param string $path
     * @param int $options
     * @return bool
     */
   
public function rmdir($path , $options);

   
/**
     * Enter description here...
     *
     * @param int $cast_as
     * @return resource
     */
   
public function stream_cast($cast_as);

   
/**
     * Enter description here...
     *
     */
   
public function stream_close();

   
/**
     * Enter description here...
     *
     * @return bool
     */
   
public function stream_eof();

   
/**
     * Enter description here...
     *
     * @return bool
     */
   
public function stream_flush();

   
/**
     * Enter description here...
     *
     * @param mode $operation
     * @return bool
     */
   
public function stream_lock($operation);

   
/**
     * Enter description here...
     *
     * @param string $path
     * @param string $mode
     * @param int $options
     * @param string &$opened_path
     * @return bool
     */
   
public function stream_open($path , $mode , $options , &$opened_path);

   
/**
     * Enter description here...
     *
     * @param int $count
     * @return string
     */
   
public function stream_read($count);

   
/**
     * Enter description here...
     *
     * @param int $offset
     * @param int $whence = SEEK_SET
     * @return bool
     */
   
public function stream_seek($offset , $whence = SEEK_SET);

   
/**
     * Enter description here...
     *
     * @param int $option
     * @param int $arg1
     * @param int $arg2
     * @return bool
     */
   
public function stream_set_option($option , $arg1 , $arg2);

   
/**
     * Enter description here...
     *
     * @return array
     */
   
public function stream_stat();

   
/**
     * Enter description here...
     *
     * @return int
     */
   
public function stream_tell();

   
/**
     * Enter description here...
     *
     * @param string $data
     * @return int
     */
   
public function stream_write($data);

   
/**
     * Enter description here...
     *
     * @param string $path
     * @return bool
     */
   
public function unlink($path);

   
/**
     * Enter description here...
     *
     * @param string $path
     * @param int $flags
     * @return array
     */
   
public function url_stat($path , $flags);
}

?>

 
show source | credits | sitemap | contact | advertising | mirror sites