IsolatedStorageFileStream 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
IsolatedStorageFileStream 클래스의 새 인스턴스를 초기화합니다. 열 수 있는 IsolatedStorageFileStream 유일한 방법은 생성자 중 하나를 사용하는 것입니다.
오버로드
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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.
적용 대상
IsolatedStorageFileStream(String, FileMode, FileAccess)
클래스의 새 인스턴스를 초기화하여 지정된 형식의 IsolatedStorageFileStreampath 요청된 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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.
적용 대상
IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile)
지정된 파일 및 지정된 컨텍스트에서 IsolatedStorageFileStream지정된 path파일에 대한 액세스를 제공하는 클래스의 새 인스턴스 mode 를 IsolatedStorageFileisf초기화합니다.
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);
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
격리된 스토리지 내 파일의 상대 경로입니다.
IsolatedStorageFile 을 열 수 있는 위치에 있습니다IsolatedStorageFileStream.
예외
형식 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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.
적용 대상
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare)
지정된 파일 공유 모드IsolatedStorageFileStream를 사용하여 지정된 pathmodeaccess파일에서 지정된 파일에 대한 액세스를 제공하는 클래스의 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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.
적용 대상
IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile)
지정된 파일 및 지정된 파일의 IsolatedStorageFileStream 컨텍스트에서 지정된 pathmodeaccess파일에 대한 액세스를 제공하는 클래스의 IsolatedStorageFileisf새 인스턴스를 초기화합니다.
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);
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 .
IsolatedStorageFile 을 열 수 있는 위치에 있습니다IsolatedStorageFileStream.
예외
형식 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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.
적용 대상
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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.
적용 대상
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile)
지정된 파일, 지정된 파일, 지정된 파일 공유 모드IsolatedStorageFileStream를 사용하여 지정한 pathmode파일 및 지정된 파일의 컨텍스트에서 지정된 파일에 access대한 액세스를 제공하는 클래스의 shareIsolatedStorageFile새 인스턴스 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);
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 .
IsolatedStorageFile 을 열 수 있는 위치에 있습니다IsolatedStorageFileStream.
예외
형식 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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.
적용 대상
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32, IsolatedStorageFile)
지정된 파일, 지정된 파일, 지정된 IsolatedStorageFileStreampath파일 공유 모드, 지정된 컨텍스트에서 지정한 파일 공유 모드 modeaccess를 사용하여 지정된 파일에 share대한 액세스를 제공하는 클래스의 bufferSizeIsolatedStorageFile새 인스턴스 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);
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 .
IsolatedStorageFile 을 열 수 있는 위치에 있습니다IsolatedStorageFileStream.
예외
형식 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
특정 문화권 설정을 사용하여 문자 집합을 컴파일하고 다른 문화권 설정으로 동일한 문자를 검색하는 경우 문자를 해석할 수 없으며 예외가 throw될 수 있습니다.