mode で指定したモード、isf で指定した IsolatedStorageFile のコンテキストを使用して、path で指定したファイルへのアクセスを提供する IsolatedStorageFileStream クラスの新しいインスタンスを初期化します。
名前空間: System.IO.IsolatedStorage
アセンブリ: mscorlib (mscorlib.dll 内)
構文
'宣言
Public Sub New ( _
path As String, _
mode As FileMode, _
isf As IsolatedStorageFile _
)
'使用
Dim path As String
Dim mode As FileMode
Dim isf As IsolatedStorageFile
Dim instance As New IsolatedStorageFileStream(path, mode, isf)
public IsolatedStorageFileStream (
string path,
FileMode mode,
IsolatedStorageFile isf
)
public:
IsolatedStorageFileStream (
String^ path,
FileMode mode,
IsolatedStorageFile^ isf
)
public IsolatedStorageFileStream (
String path,
FileMode mode,
IsolatedStorageFile isf
)
public function IsolatedStorageFileStream (
path : String,
mode : FileMode,
isf : IsolatedStorageFile
)
パラメータ
- path
分離ストレージ内でのファイルの相対パス。
- mode
FileMode 値の 1 つ。
- isf
IsolatedStorageFileStream を開くために使用する IsolatedStorageFile。
例外
例外の種類 | 条件 |
---|---|
path の形式が正しくありません。 |
|
path が null 参照 (Visual Basic では Nothing) です。 |
|
mode に Open が設定されていますが、ファイルが見つかりません。 |
|
isf はクォータを持っていません。 |
解説
mode パラメータは、新しいファイルを作成するか、既存のファイルを使用するかなどを示します。
ヒント
特定のカルチャ設定で文字セットをコンパイルし、同じ文字を異なるカルチャ設定で取得すると、文字が正しく解釈されない場合があり、例外がスローされることもあります。
使用例
このコンストラクタの使用方法については、次のコード例を参照してください。この例のコンテキスト全体については、IsolatedStorageFileStream の概要を参照してください。
' Open or create a writable file.
Dim target As New IsolatedStorageFileStream("Archive\ " & Me.userName, _
FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write, isoFile)
IsolatedStorageFileStream source =
new IsolatedStorageFileStream(this.userName, FileMode.OpenOrCreate,
isoFile);
// This is the stream from which data will be read.
Console.WriteLine("Is the source file readable? " + (source.CanRead ? "true" : "false"));
Console.WriteLine("Creating new IsolatedStorageFileStream for Archive.");
// Open or create a writable file.
IsolatedStorageFileStream target =
new IsolatedStorageFileStream("Archive\\ " + this.userName,
FileMode.OpenOrCreate,
FileAccess.Write,
FileShare.Write,
isoFile);
// This is the stream to which data will be written.
IsolatedStorageFileStream^ source = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,isoFile );
// This is the stream from which data will be read.
Console::WriteLine( "Is the source file readable? {0}", (source->CanRead ? (String^)"true" : "false") );
Console::WriteLine( "Creating new IsolatedStorageFileStream for Archive." );
// Open or create a writable file.
IsolatedStorageFileStream^ target = gcnew IsolatedStorageFileStream( String::Concat("Archive\\",this->userName),FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,isoFile );
.NET Framework のセキュリティ
- IsolatedStorageFilePermission (分離ストレージへのアクセス用)
プラットフォーム
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 名前空間