Freigeben über


IsolatedStorageFileStream-Konstruktor (String, FileMode, IsolatedStorageFile)

Initialisiert eine neue Instanz der IsolatedStorageFileStream-Klasse, die im angegebenen mode und im Kontext der durch isf angegebenen IsolatedStorageFile-Klasse Zugriff auf die durch path bezeichnete Datei ermöglicht.

Namespace: System.IO.IsolatedStorage
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Sub New ( _
    path As String, _
    mode As FileMode, _
    isf As IsolatedStorageFile _
)
'Usage
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
)

Parameter

  • path
    Der relative Pfad der Datei innerhalb des isolierten Speichers.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentException

Der path ist nicht wohlgeformt.

ArgumentNullException

path ist NULL (Nothing in Visual Basic).

FileNotFoundException

Es wurde keine Datei gefunden, und mode ist auf Open festgelegt.

IsolatedStorageException

isf verfügt über kein Kontingent.

Hinweise

Der mode-Parameter gibt an, ob eine neue Datei erstellt oder eine vorhandene verwendet werden soll usw.

Warnung

Wenn Sie einen Zeichensatz mit einer bestimmten Kultureinstellung kompilieren und die gleichen Zeichen mit einer anderen Kultureinstellung abrufen, können diese möglicherweise nicht interpretiert werden, und es wird eine Ausnahme ausgelöst.

Beispiel

Das folgende Codebeispiel veranschaulicht die Verwendung dieses Konstruktors. Den vollständigen Kontext dieses Beispiels finden Sie in der Übersicht zu 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-Sicherheit

Plattformen

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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

IsolatedStorageFileStream-Klasse
IsolatedStorageFileStream-Member
System.IO.IsolatedStorage-Namespace