PackagePart.GetStream 方法

定义

返回部分内容数据流。Returns the part content data stream.

重载

GetStream()

返回部分内容数据流。Returns the part content data stream.

GetStream(FileMode)

返回在指定 I/O FileMode 中打开的内容流。Returns the content stream opened in a specified I/O FileMode.

GetStream(FileMode, FileAccess)

返回使用指定 FileModeFileAccess 打开的部分内容流。Returns the part content stream opened with a specified FileMode and FileAccess.

GetStream()

返回部分内容数据流。Returns the part content data stream.

public:
 System::IO::Stream ^ GetStream();
public System.IO.Stream GetStream ();
member this.GetStream : unit -> System.IO.Stream
Public Function GetStream () As Stream

返回

Stream

此部分的内容数据流。The content data stream for the part.

例外

已删除此部分。The part has been deleted.

- 或 --or- Package 没有打开(调用了 Dispose(Boolean)Close())。The Package is not open (Dispose(Boolean) or Close() has been called).

派生子类的 GetStreamCore(FileMode, FileAccess) 方法返回的流对象是 nullThe stream object returned by the GetStreamCore(FileMode, FileAccess) method of the derived subclass is null.

注解

此方法会打开内容流,其具有 FileMode OpenOrCreateFileAccess 权限,这些权限与父级相同 PackageThis method opens the content stream with FileMode of OpenOrCreate and FileAccess permissions that are the same as the parent Package.

重载 GetStream 方法允许您设置特定的 FileModeThe overload GetStream method allows you to set a specific FileMode.

调用方说明

GetStream() 在内部调用派生 GetStreamCore(FileMode, FileAccess) 方法,以实际打开并返回基于派生类中实现的物理格式的部分数据流。 GetStream() internally calls the derived GetStreamCore(FileMode, FileAccess) method to actually open and return the part data stream based on the physical format implemented in the derived class.

默认情况下,将 ZipPackagePart PackagePart 提供并使用抽象类的子类实现。By default, the ZipPackagePart subclass implementation of the abstract PackagePart class is provided and used. 在默认操作中,在 GetStream() 内部调用 GetStreamCore(FileMode, FileAccess) ZipPackagePart 类以打开并返回 ZIP 文件中的部分数据流。In the default operation, GetStream() internally calls GetStreamCore(FileMode, FileAccess) of the ZipPackagePart class to open and return the part data stream from a ZIP file.

适用于

GetStream(FileMode)

返回在指定 I/O FileMode 中打开的内容流。Returns the content stream opened in a specified I/O FileMode.

public:
 System::IO::Stream ^ GetStream(System::IO::FileMode mode);
public System.IO.Stream GetStream (System.IO.FileMode mode);
member this.GetStream : System.IO.FileMode -> System.IO.Stream
Public Function GetStream (mode As FileMode) As Stream

参数

mode
FileMode

打开内容流时采用的 I/O 模式。The I/O mode in which to open the content stream.

返回

Stream

此部分的内容流。The content stream of the part.

例外

已删除此部分。The part has been deleted.

- 或 --or- Package 没有打开(调用了 Dispose(Boolean)Close())。The Package is not open (Dispose(Boolean) or Close() has been called).

mode 参数不是有效的 FileMode 枚举值。The mode parameter is not a valid FileMode enumeration value.

mode 参数与包和部分流不兼容。The mode parameter is not compatible with the package and part stream.

- 或 --or- 派生子类的 GetStreamCore(FileMode, FileAccess) 方法返回的流对象是 nullThe stream object returned by the GetStreamCore(FileMode, FileAccess) method of the derived subclass is null.

注解

FileAccess返回内容流的权限与父对象的权限相同 PackageThe FileAccess permissions of the returned content stream are the same as the permissions of the parent Package.

调用方说明

GetStream(FileMode) 在内部调用派生 GetStreamCore(FileMode, FileAccess) 方法,以实际打开并返回基于派生类中实现的物理格式的部分数据流。 GetStream(FileMode) internally calls the derived GetStreamCore(FileMode, FileAccess) method to actually open and return the part data stream based on the physical format implemented in the derived class.

默认情况下,将 ZipPackagePart PackagePart 提供并使用抽象类的子类实现。By default, the ZipPackagePart subclass implementation of the abstract PackagePart class is provided and used. 在默认操作中,在 GetStream(FileMode) 内部调用 GetStreamCore(FileMode, FileAccess) ZipPackagePart 类以打开并返回 ZIP 文件中的部分数据流。In the default operation, GetStream(FileMode) internally calls GetStreamCore(FileMode, FileAccess) of the ZipPackagePart class to open and return the part data stream from a ZIP file.

适用于

GetStream(FileMode, FileAccess)

返回使用指定 FileModeFileAccess 打开的部分内容流。Returns the part content stream opened with a specified FileMode and FileAccess.

public:
 System::IO::Stream ^ GetStream(System::IO::FileMode mode, System::IO::FileAccess access);
public System.IO.Stream GetStream (System.IO.FileMode mode, System.IO.FileAccess access);
member this.GetStream : System.IO.FileMode * System.IO.FileAccess -> System.IO.Stream
Public Function GetStream (mode As FileMode, access As FileAccess) As Stream

参数

mode
FileMode

打开内容流时采用的 I/O 模式。The I/O mode in which to open the content stream.

access
FileAccess

打开内容流时使用的访问权限。The access permissions to use in opening the content stream.

返回

Stream

此部分的内容流。The content stream for the part.

例外

已删除此部分。The part has been deleted.

- 或 --or- Package 没有打开(调用了 Dispose(Boolean)Close())。The Package is not open (Dispose(Boolean) or Close() has been called).

mode 参数不是有效的 FileMode 枚举值。The mode parameter is not a valid FileMode enumeration value.

- 或 --or- access 参数不是有效的 FileAccess 枚举值。The access parameter is not a valid FileAccess enumeration value.

modeaccess 与包和部分流不兼容。mode or access is not compatible with the package and part stream.

- 或 --or- access 参数指定为 Read,但 mode 参数需要写访问权。The access parameter is specified as Read but the mode parameter requires write access. FileModeCreateCreateNewTruncateAppend 值需要 WriteReadWrite 访问权限。)(FileMode values of Create, CreateNew, Truncate, and Append require Write or ReadWrite access.) - 或 --or- 派生子类的 GetStreamCore(FileMode, FileAccess) 方法返回的流对象是 nullThe stream object returned by the GetStreamCore(FileMode, FileAccess) method of the derived subclass is null.

调用方说明

GetStream(FileMode, FileAccess) 在内部调用派生 GetStreamCore(FileMode, FileAccess) 方法,以实际打开并返回基于派生类中实现的物理格式的部分数据流。 GetStream(FileMode, FileAccess) internally calls the derived GetStreamCore(FileMode, FileAccess) method to actually open and return the part data stream based on the physical format implemented in the derived class.

默认情况下,将 ZipPackagePart PackagePart 提供并使用抽象类的子类实现。By default, the ZipPackagePart subclass implementation of the abstract PackagePart class is provided and used. 在默认操作中,在 GetStream(FileMode, FileAccess) 内部调用 GetStreamCore(FileMode, FileAccess) ZipPackagePart 类以打开并返回 ZIP 文件中的部分数据流。In the default operation, GetStream(FileMode, FileAccess) internally calls GetStreamCore(FileMode, FileAccess) of the ZipPackagePart class to open and return the part data stream from a ZIP file.

适用于