mode で指定したモード、isf で指定した IsolatedStorageFile のコンテキストを使用して、path で指定したファイルへの、access で指定した種類のアクセスを提供する IsolatedStorageFileStream クラスの新しいインスタンスを初期化します。
名前空間: System.IO.IsolatedStorage
アセンブリ: mscorlib (mscorlib.dll 内)
構文
'宣言
Public Sub New ( _
path As String, _
mode As FileMode, _
access As FileAccess, _
isf As IsolatedStorageFile _
)
'使用
Dim path As String
Dim mode As FileMode
Dim access As FileAccess
Dim isf As IsolatedStorageFile
Dim instance As New IsolatedStorageFileStream(path, mode, access, isf)
public IsolatedStorageFileStream (
string path,
FileMode mode,
FileAccess access,
IsolatedStorageFile isf
)
public:
IsolatedStorageFileStream (
String^ path,
FileMode mode,
FileAccess access,
IsolatedStorageFile^ isf
)
public IsolatedStorageFileStream (
String path,
FileMode mode,
FileAccess access,
IsolatedStorageFile isf
)
public function IsolatedStorageFileStream (
path : String,
mode : FileMode,
access : FileAccess,
isf : IsolatedStorageFile
)
パラメータ
- path
分離ストレージ内でのファイルの相対パス。
- mode
FileMode 値の 1 つ。
- access
FileAccess 値のビットごとの組み合わせ。
- isf
IsolatedStorageFileStream を開くために使用する IsolatedStorageFile。
例外
例外の種類 | 条件 |
---|---|
path の形式が正しくありません。 |
|
path が null 参照 (Visual Basic では Nothing) です。 |
|
mode に Open が設定されていますが、ファイルが見つかりません。 |
|
isf はクォータを持っていません。 |
解説
mode パラメータは、新しいファイルを作成するか、既存のファイルを使用するかを示します。access パラメータには、読み取り専用、読み取り/書き込み可能、および書き込み専用を組み合わせて指定します。
ヒント
特定のカルチャ設定で文字セットをコンパイルし、同じ文字を異なるカルチャ設定で取得すると、文字が正しく解釈されない場合があり、例外がスローされることもあります。
使用例
このコンストラクタの使用方法については、次のコード例を参照してください。この例のコンテキスト全体については、IsolatedStorageFileStream の概要を参照してください。
Dim isoFile As IsolatedStorageFile
isoFile = IsolatedStorageFile.GetUserStoreForDomain()
' Open or create a writable file.
Dim isoStream As New IsolatedStorageFileStream(Me.userName, FileMode.OpenOrCreate, _
FileAccess.Write, isoFile)
Dim writer As New StreamWriter(isoStream)
writer.WriteLine(Me.NewsUrl)
writer.WriteLine(Me.SportsUrl)
' Calculate the amount of space used to record the user's preferences.
Dim d As Double = Convert.ToDouble(isoFile.CurrentSize) / Convert.ToDouble(isoFile.MaximumSize)
Console.WriteLine(("CurrentSize = " & isoFile.CurrentSize.ToString()))
Console.WriteLine(("MaximumSize = " & isoFile.MaximumSize.ToString()))
' StreamWriter.Close implicitly closes isoStream.
writer.Close()
isoFile.Dispose()
isoFile.Close()
Return d
IsolatedStorageFile isoFile;
isoFile = IsolatedStorageFile.GetUserStoreForDomain();
// Open or create a writable file.
IsolatedStorageFileStream isoStream =
new IsolatedStorageFileStream(this.userName,
FileMode.OpenOrCreate,
FileAccess.Write,
isoFile);
StreamWriter writer = new StreamWriter(isoStream);
writer.WriteLine(this.NewsUrl);
writer.WriteLine(this.SportsUrl);
// Calculate the amount of space used to record the user's preferences.
double d = isoFile.CurrentSize / isoFile.MaximumSize;
Console.WriteLine("CurrentSize = " + isoFile.CurrentSize.ToString());
Console.WriteLine("MaximumSize = " + isoFile.MaximumSize.ToString());
// StreamWriter.Close implicitly closes isoStream.
writer.Close();
isoFile.Dispose();
isoFile.Close();
return d;
IsolatedStorageFile^ isoFile;
isoFile = IsolatedStorageFile::GetUserStoreForDomain();
// Open or create a writable file.
IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,isoFile );
StreamWriter^ writer = gcnew StreamWriter( isoStream );
writer->WriteLine( this->NewsUrl );
writer->WriteLine( this->SportsUrl );
// Calculate the amount of space used to record the user's preferences.
double d = isoFile->CurrentSize / isoFile->MaximumSize;
Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() );
Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() );
writer->Close();
isoFile->Close();
isoStream->Close();
return d;
.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 名前空間