Freigeben über


IsolatedStorageFileStream Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Exposes a file within isolated storage.

Inheritance Hierarchy

System.Object
  System.IO.Stream
    System.IO.FileStream
      System.IO.IsolatedStorage.IsolatedStorageFileStream

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

Syntax

'Declaration
<ComVisibleAttribute(True)> _
Public Class IsolatedStorageFileStream _
    Inherits FileStream
[ComVisibleAttribute(true)]
public class IsolatedStorageFileStream : FileStream

The IsolatedStorageFileStream type exposes the following members.

Constructors

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile) Initializes a new instance of the IsolatedStorageFileStream class giving access to the file designated by path, in the specified mode, and in the context of the IsolatedStorageFile specified by isf.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile) Initializes a new instance of the IsolatedStorageFileStream class giving access to the file designated by path in the specified mode, with the specified file access, and in the context of the IsolatedStorageFile specified by isf.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile) Initializes a new instance of the IsolatedStorageFileStream class giving access to the file designated by path, in the specified mode, with the specified file access, using the file sharing mode specified by share, and in the context of the IsolatedStorageFile specified by isf.

Top

Properties

  Name Description
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 CanRead Gets a Boolean value indicating whether the file can be read. (Overrides FileStream.CanRead.)
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 CanSeek Gets a Boolean value indicating whether seek operations are supported. (Overrides FileStream.CanSeek.)
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 CanTimeout Gets a value that determines whether the current stream can time out. (Inherited from Stream.)
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 CanWrite Gets a Boolean value indicating whether you can write to the file. (Overrides FileStream.CanWrite.)
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 Length Gets the length of the IsolatedStorageFileStream object. (Overrides FileStream.Length.)
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 Name When it is called by trusted applications, gets the name of the file stream that was passed to the constructor. (Inherited from FileStream.)

In Silverlight for Windows Phone Windows Phone OS 7.1, this member is Name.

In XNA Framework Xbox 360, this member is Name.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 Position Gets or sets the current position of the current IsolatedStorageFileStream object. (Overrides FileStream.Position.)
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 ReadTimeout Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out. (Inherited from Stream.)
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360 WriteTimeout Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out. (Inherited from Stream.)

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 BeginRead Begins an asynchronous read. (Overrides FileStream.BeginRead(array<Byte[], Int32, Int32, AsyncCallback, Object).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 BeginWrite Begins an asynchronous write. (Overrides FileStream.BeginWrite(array<Byte[], Int32, Int32, AsyncCallback, Object).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Close Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. (Inherited from Stream.)
Public methodSupported by Silverlight for Windows Phone CopyTo(Stream) Reads all the bytes from the current stream and writes them to the destination stream. (Inherited from Stream.)
Public methodSupported by Silverlight for Windows Phone CopyTo(Stream, Int32) Reads all the bytes from the current stream and writes them to a destination stream, using a specified buffer size. (Inherited from Stream.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Dispose() Releases all resources used by the Stream. (Inherited from Stream.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Dispose(Boolean) Releases the unmanaged resources used by the IsolatedStorageFileStream and optionally releases the managed resources. (Overrides FileStream.Dispose(Boolean).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 EndRead Ends a pending asynchronous read request. (Overrides FileStream.EndRead(IAsyncResult).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 EndWrite Ends an asynchronous write. (Overrides FileStream.EndWrite(IAsyncResult).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Finalize Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the FileStream. (Inherited from FileStream.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Flush() Updates the file with the current state of the buffer then clears the buffer. (Overrides FileStream.Flush().)
Public methodSupported by Silverlight for Windows Phone Flush(Boolean) Clears buffers for this stream and causes any buffered data to be written to the file, and also clears all intermediate file buffers. (Overrides FileStream.Flush(Boolean).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetType Gets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Read Copies bytes from the current buffered IsolatedStorageFileStream object to an array. (Overrides FileStream.Read(array<Byte[], Int32, Int32).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ReadByte Reads a single byte from the IsolatedStorageFileStream object in isolated storage. (Overrides FileStream.ReadByte().)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Seek Sets the current position of this IsolatedStorageFileStream object to the specified value. (Overrides FileStream.Seek(Int64, SeekOrigin).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 SetLength Sets the length of this IsolatedStorageFileStream object to the specified value. (Overrides FileStream.SetLength(Int64).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToString Returns a string that represents the current object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Write Writes a block of bytes to the IsolatedStorageFileStream object using data read from a byte array. (Overrides FileStream.Write(array<Byte[], Int32, Int32).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 WriteByte Writes a single byte to the IsolatedStorageFileStream object. (Overrides FileStream.WriteByte(Byte).)

Top

Remarks

Use this class to read, write and create files in isolated storage.

Since this class extends FileStream, you can use an instance of IsolatedStorageFileStream in most situations where a FileStream might otherwise be used, such as to construct a StreamReader or StreamWriter.

Examples

The following example uses a StreamReader object to read an IsolatedStorageFileStream that is obtained from an isolated storage file.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.