IsolatedStorageFileStream コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
IsolatedStorageFileStream クラスの新しいインスタンスを初期化します。 IsolatedStorageFileStreamを開く唯一の方法は、コンストラクターの 1 つを使用することです。
オーバーロード
IsolatedStorageFileStream(String, FileMode)
指定したIsolatedStorageFileStreamのpathによって指定されたファイルへのアクセスを許可するmode オブジェクトの新しいインスタンスを初期化します。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
例外
pathが正しく形成されていません。
path は null です。
path内のディレクトリが存在しません。
ファイルが見つかりませんでした。 mode は Open
注釈
使用される分離ストアのスコープは、現在実行中のアセンブリの ID と、それが実行されているアプリケーション ドメインの ID です。 このストアは、 IsolatedStorageFileStream オブジェクトの有効期間中のみ開いたままです。 別の分離ストレージ スコープを指定したり、ストアを開いたままにしたり (複数の IsolatedStorageFileStream オブジェクトを開くことができるように)、 IsolatedStorageFile オブジェクトを受け入れるコンストラクターの形式を使用します。
mode パラメーターは、新しいファイルを作成するかどうか、既存のファイルを使用するかどうかを示します。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。
適用対象
IsolatedStorageFileStream(String, FileMode, FileAccess)
IsolatedStorageFileStream クラスの新しいインスタンスを初期化し、指定したpathで、modeが指定したファイルにアクセスaccess要求します。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
- access
- FileAccess
FileAccess値のビットごとの組み合わせ。
例外
pathが正しく形成されていません。
path は null です。
ファイルが見つかりませんでした。 mode は Open に設定されています。
注釈
使用される分離ストアのスコープは、現在実行中のアセンブリの ID と、それが実行されているアプリケーション ドメインの ID です。 このストアは、 IsolatedStorageFileStream オブジェクトの有効期間中のみ開いたままです。 別の分離ストレージ スコープを指定したり、ストアを開いたままにしたり (複数の IsolatedStorageFileStream オブジェクトを開くことができるように)、 IsolatedStorageFile オブジェクトを受け入れるコンストラクターの形式を使用します。
mode パラメーターは、新しいファイルを作成するか、既存のファイルを使用するかを示します。
access パラメーターには、読み取り専用、読み取り/書き込み、および書き込み専用が含まれます。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。
適用対象
IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile)
IsolatedStorageFileStreamによって指定されたファイル、指定されたpath、およびmodeで指定されたIsolatedStorageFileのコンテキストでアクセスを許可する、isf クラスの新しいインスタンスを初期化します。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.IsolatedStorage.IsolatedStorageFile isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, isf As IsolatedStorageFile)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
例外
pathが正しく形成されていません。
path は null です。
ファイルが見つかりませんでした。 mode は Open に設定されています。
isf にはクォータがありません。
例
次のコード例では、このコンストラクターの使用方法を示します。 この例の完全なコンテキストについては、 IsolatedStorageFileStream の概要を参照してください。
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);
' Open or create a writable file.
Dim target As New IsolatedStorageFileStream("Archive\ " & Me.userName, _
FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write, isoFile)
注釈
mode パラメーターは、新しいファイルを作成するかどうか、既存のファイルを使用するかどうかを示します。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。
適用対象
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare)
IsolatedStorageFileStream
pathで指定されたファイル共有モードを使用して、指定したmodeで指定されたファイルにアクセスするaccess クラスの新しいインスタンスを、指定したファイルshareで初期化します。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
- access
- FileAccess
FileAccess値のビットごとの組み合わせ。
例外
pathが正しく形成されていません。
path は null です。
ファイルが見つかりませんでした。 mode は Open に設定されています。
例
次のコード例では、このコンストラクターの使用方法を示します。 この例の完全なコンテキストについては、 IsolatedStorageFileStream の概要を参照してください。
// 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("substituteUsername",
System.IO.FileMode.Open,
System.IO.FileAccess.Read,
System.IO.FileShare.Read);
' 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("substituteUsername", System.IO.FileMode.Open, _
System.IO.FileAccess.Read, System.IO.FileShare.Read)
注釈
使用される分離ストアのスコープは、現在実行中のアセンブリの ID と、それが実行されているアプリケーション ドメインの ID です。 このストアは、 IsolatedStorageFileStream オブジェクトの有効期間中のみ開いたままです。 別の分離ストレージ スコープを指定したり、ストアを開いたままにしたり (複数の IsolatedStorageFileStream オブジェクトを開くことができるように)、 IsolatedStorageFile オブジェクトを受け入れるコンストラクターの形式を使用します。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。
適用対象
IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile)
IsolatedStorageFileStream クラスの新しいインスタンスを初期化し、指定したpath内のmodeによって指定されたファイルへのアクセスを許可します。指定したファイルaccessを使用して、IsolatedStorageFileによって指定されたisfのコンテキストで行います。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.IsolatedStorage.IsolatedStorageFile isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, isf As IsolatedStorageFile)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
- access
- FileAccess
FileAccess値のビットごとの組み合わせ。
例外
pathが正しく形成されていません。
path は null です。
分離ストアは閉じられます。
ファイルが見つかりませんでした。 mode は Open に設定されています。
isf にはクォータがありません。
例
次のコード例では、このコンストラクターの使用方法を示します。 この例の完全なコンテキストについては、 IsolatedStorageFileStream の概要を参照してください。
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;
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
注釈
mode パラメーターは、新しいファイルを作成するか、既存のファイルを使用するかを示します。
access パラメーターには、読み取り専用、読み取り/書き込み、および書き込み専用が含まれます。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。
適用対象
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32)
指定したIsolatedStorageFileStreamで指定されたファイル共有モードを使用して、指定したpath内のmodeが指定した accessファイルにアクセスできるように、share クラスの新しいインスタンスを初期化bufferSize指定します。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, int bufferSize);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * int -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, bufferSize As Integer)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
- access
- FileAccess
FileAccess値のビットごとの組み合わせ。
- bufferSize
- Int32
FileStream バッファー サイズ。
例外
pathが正しく形成されていません。
path は null です。
ファイルが見つかりませんでした。 mode は Open に設定されています。
注釈
使用される分離ストアのスコープは、現在実行中のアセンブリの ID と、それが実行されているアプリケーション ドメインの ID です。 このストアは、 IsolatedStorageFileStream オブジェクトの有効期間中のみ開いたままです。 別の分離ストレージ スコープを指定したり、ストアを開いたままにしたり (複数の IsolatedStorageFileStream オブジェクトを開くことができるように)、 IsolatedStorageFile オブジェクトを受け入れるコンストラクターの形式を使用します。
mode パラメーターは、新しいファイルを作成するか、既存のファイルを使用するかを示します。
access パラメーターには、読み取り専用、読み取り/書き込み、および書き込み専用が含まれます。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。
適用対象
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile)
IsolatedStorageFileStreamによって指定されたファイルへのアクセスを許可するpath クラスの新しいインスタンスを初期化します。指定したmodeで、指定したファイルaccessで、shareで指定されたファイル共有モードを使用して、IsolatedStorageFileで指定されたisfのコンテキストで初期化します。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.IO.IsolatedStorage.IsolatedStorageFile isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, isf As IsolatedStorageFile)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
- access
- FileAccess
FileAccess値のビットごとの組み合わせ。
例外
pathが正しく形成されていません。
path は null です。
ファイルが見つかりませんでした。 mode は Open に設定されています。
isf にはクォータがありません。
例
次のコード例では、このコンストラクターの使用方法を示します。 この例の完全なコンテキストについては、 IsolatedStorageFileStream の概要を参照してください。
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);
' Open or create a writable file.
Dim target As New IsolatedStorageFileStream("Archive\ " & Me.userName, _
FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write, isoFile)
注釈
mode パラメーターは、新しいファイルを作成するか、既存のファイルを使用するかを示します。
access パラメーターには、読み取り専用、読み取り/書き込み、および書き込み専用が含まれます。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。
適用対象
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32, IsolatedStorageFile)
指定したIsolatedStorageFileStreamで指定されたファイルへのアクセスを許可するpath クラスの新しいインスタンスを初期化します。指定したmodeで、指定したファイルaccessで、shareで指定されたファイル共有モードを使用し、bufferSizeを指定して、IsolatedStorageFileによって指定されたisfのコンテキストで使用します。
public:
IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, int bufferSize, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * int * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, bufferSize As Integer, isf As IsolatedStorageFile)
パラメーター
- path
- String
分離ストレージ内のファイルの相対パス。
- access
- FileAccess
FileAccess値のビットごとの組み合わせ。
- bufferSize
- Int32
FileStream バッファー サイズ。
例外
pathが正しく形成されていません。
path は null です。
ファイルが見つかりませんでした。 mode は Open に設定されています。
isf にはクォータがありません。
例
次のコード例では、このコンストラクターの使用方法を示します。 この例の完全なコンテキストについては、 IsolatedStorageFileStream の概要を参照してください。
// Open or create a writable file with a maximum size of 10K.
IsolatedStorageFileStream isoStream =
new IsolatedStorageFileStream(this.userName,
FileMode.OpenOrCreate,
FileAccess.Write,
FileShare.Write,
10240,
isoFile);
' Open or create a writable file with a maximum size of 10K.
Dim isoStream As New IsolatedStorageFileStream(Me.userName, FileMode.OpenOrCreate, _
FileAccess.Write, FileShare.Write, 10240, isoFile)
注釈
mode パラメーターは、新しいファイルを作成するか、既存のファイルを使用するかを示します。
access パラメーターには、読み取り専用、読み取り/書き込み、および書き込み専用が含まれます。
Caution
特定のカルチャ設定で文字のセットをコンパイルし、異なるカルチャ設定で同じ文字を取得すると、文字が解釈できず、例外がスローされる可能性があります。