Freigeben über


IsolatedStorageFileStream-Konstruktor (String, FileMode, FileAccess, FileShare, IsolatedStorageFile)

Initialisiert eine neue Instanz einer IsolatedStorageFileStream-Klasse, die im angegebenen mode im durch isf angegebenen Kontext des IsolatedStorageFile des durch share angegebenen Dateifreigabemodus den angegebenen Datei-access auf die durch path definierte Datei ermöglicht.

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

Syntax

'Declaration
Public Sub New ( _
    path As String, _
    mode As FileMode, _
    access As FileAccess, _
    share As FileShare, _
    isf As IsolatedStorageFile _
)
'Usage
Dim path As String
Dim mode As FileMode
Dim access As FileAccess
Dim share As FileShare
Dim isf As IsolatedStorageFile

Dim instance As New IsolatedStorageFileStream(path, mode, access, share, isf)
public IsolatedStorageFileStream (
    string path,
    FileMode mode,
    FileAccess access,
    FileShare share,
    IsolatedStorageFile isf
)
public:
IsolatedStorageFileStream (
    String^ path, 
    FileMode mode, 
    FileAccess access, 
    FileShare share, 
    IsolatedStorageFile^ isf
)
public IsolatedStorageFileStream (
    String path, 
    FileMode mode, 
    FileAccess access, 
    FileShare share, 
    IsolatedStorageFile isf
)
public function IsolatedStorageFileStream (
    path : String, 
    mode : FileMode, 
    access : FileAccess, 
    share : FileShare, 
    isf : IsolatedStorageFile
)

Parameter

  • path
    Der relative Pfad der Datei innerhalb des isolierten Speichers.
  • access
    Eine bitweise Kombination der FileAccess-Werte.
  • share
    Eine bitweise Kombination der FileShare-Werte.

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. Der access-Parameter umfasst die Zugriffsarten Nur-Lesen, Lesen und Schreiben sowie Nur-Schreiben.

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