次の方法で共有


IsolatedStorageFileStream コンストラクタ (String, FileMode, FileAccess, FileShare)

mode で指定したモード、share で指定した共有モードを使用して、path で指定したファイルへの、access で指定した種類のアクセスを提供する IsolatedStorageFileStream クラスの新しいインスタンスを初期化します。

名前空間: System.IO.IsolatedStorage
アセンブリ: mscorlib (mscorlib.dll 内)

構文

'宣言
Public Sub New ( _
    path As String, _
    mode As FileMode, _
    access As FileAccess, _
    share As FileShare _
)
'使用
Dim path As String
Dim mode As FileMode
Dim access As FileAccess
Dim share As FileShare

Dim instance As New IsolatedStorageFileStream(path, mode, access, share)
public IsolatedStorageFileStream (
    string path,
    FileMode mode,
    FileAccess access,
    FileShare share
)
public:
IsolatedStorageFileStream (
    String^ path, 
    FileMode mode, 
    FileAccess access, 
    FileShare share
)
public IsolatedStorageFileStream (
    String path, 
    FileMode mode, 
    FileAccess access, 
    FileShare share
)
public function IsolatedStorageFileStream (
    path : String, 
    mode : FileMode, 
    access : FileAccess, 
    share : FileShare
)

パラメータ

  • path
    分離ストレージ内でのファイルの相対パス。
  • access
    FileAccess 値のビットごとの組み合わせ。
  • share
    FileShare 値のビットごとの組み合わせ。

例外

例外の種類 条件

ArgumentException

path の形式が正しくありません。

ArgumentNullException

path が null 参照 (Visual Basic では Nothing) です。

FileNotFoundException

mode に Open が設定されていますが、ファイルが見つかりません。

解説

使用する分離ストアのスコープは、現在実行されているアセンブリの ID と、このアセンブリを実行しているアプリケーション ドメインの ID によって指定されます。このストアは、IsolatedStorageFileStream オブジェクトの有効期間の間だけ開かれたままになります。別の分離ストレージ スコープを指定するか、ストアを開いたままにすることで、複数の IsolatedStorageFileStream オブジェクトを開くことができるようにする場合は、IsolatedStorageFile オブジェクトを扱える形式のコンストラクタを使用します。

ヒント

特定のカルチャ設定で文字セットをコンパイルし、同じ文字を異なるカルチャ設定で取得すると、文字が解釈されないことがあります。さらに、例外がスローされることもあります。

使用例

このコンストラクタの使用方法については、次のコード例を参照してください。この例のコンテキスト全体については、IsolatedStorageFileStream の概要を参照してください。

' Retrieve an IsolatedStorageFile for the current Domain and Assembly.
Dim isoFile As IsolatedStorageFile = _
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User _
    Or IsolatedStorageScope.Assembly _
    Or IsolatedStorageScope.Domain, Nothing, Nothing)

Dim isoStream As New IsolatedStorageFileStream(Me.userName, FileMode.Open, _
    FileAccess.Read, FileShare.Read)
// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
IsolatedStorageFile isoFile =
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
    IsolatedStorageScope.Assembly |
    IsolatedStorageScope.Domain,
    null,
    null);

IsolatedStorageFileStream isoStream =
    new IsolatedStorageFileStream(this.userName,
    FileMode.Open,
    FileAccess.Read,
    FileShare.Read);
// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast<IsolatedStorageScope>(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), (Type^)nullptr, nullptr );
IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::Open,FileAccess::ReadWrite,isoFile );

.NET Framework のセキュリティ

プラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

IsolatedStorageFileStream クラス
IsolatedStorageFileStream メンバ
System.IO.IsolatedStorage 名前空間