PipeStream PipeStream PipeStream PipeStream Class

定義

公開管道的 Stream 物件,其兼具匿名與具名管道的支援。Exposes a Stream object around a pipe, which supports both anonymous and named pipes.

public ref class PipeStream abstract : System::IO::Stream
public abstract class PipeStream : System.IO.Stream
type PipeStream = class
    inherit Stream
Public MustInherit Class PipeStream
Inherits Stream
繼承
衍生

備註

PipeStream類別提供基底類別的.NET Framework 中的具名和匿名管道作業。The PipeStream class provides the base class for named and anonymous pipes operations in the .NET Framework. 使用NamedPipeServerStreamNamedPipeClientStream具名的管道作業的類別。Use the NamedPipeServerStream and NamedPipeClientStream classes for named pipe operations. 使用AnonymousPipeServerStreamAnonymousPipeClientStream匿名管道作業的類別。Use the AnonymousPipeServerStream and AnonymousPipeClientStream classes for anonymous pipe operations.

如需有關管道的詳細資訊,請參閱管道For more information about pipes, see Pipes. 如需匿名管道的範例,請參閱How to:使用匿名管道進行本機處理序間通訊For an example of anonymous pipes, see How to: Use Anonymous Pipes for Local Interprocess Communication. 如需具名管道的範例,請參閱How to:使用具名管道進行網路處理序間通訊For an example of named pipes, see How to: Use Named Pipes for Network Interprocess Communication.

建構函式

PipeStream(PipeDirection, Int32) PipeStream(PipeDirection, Int32) PipeStream(PipeDirection, Int32) PipeStream(PipeDirection, Int32)

使用指定的 PipeDirection 值和緩衝區大小,初始化 PipeStream 類別的新執行個體。Initializes a new instance of the PipeStream class using the specified PipeDirection value and buffer size.

PipeStream(PipeDirection, PipeTransmissionMode, Int32) PipeStream(PipeDirection, PipeTransmissionMode, Int32) PipeStream(PipeDirection, PipeTransmissionMode, Int32) PipeStream(PipeDirection, PipeTransmissionMode, Int32)

使用指定的 PipeDirectionPipeTransmissionMode 和緩衝區大小,初始化 PipeStream 類別的新執行個體。Initializes a new instance of the PipeStream class using the specified PipeDirection, PipeTransmissionMode, and buffer size.

屬性

CanRead CanRead CanRead CanRead

取得值,表示目前的資料流是否支援讀取作業。Gets a value indicating whether the current stream supports read operations.

CanSeek CanSeek CanSeek CanSeek

取得值,表示目前的資料流是否支援搜尋作業。Gets a value indicating whether the current stream supports seek operations.

CanTimeout CanTimeout CanTimeout CanTimeout

取得值,該值判斷目前的資料流是否可以逾時。Gets a value that determines whether the current stream can time out.

(Inherited from Stream)
CanWrite CanWrite CanWrite CanWrite

取得值,表示目前的資料流是否支援寫入作業。Gets a value indicating whether the current stream supports write operations.

InBufferSize InBufferSize InBufferSize InBufferSize

取得管道的傳入緩衝區大小 (以位元組為單位)。Gets the size, in bytes, of the inbound buffer for a pipe.

IsAsync IsAsync IsAsync IsAsync

取得值,指出 PipeStream 物件是非同步開啟還是同步開啟。Gets a value indicating whether a PipeStream object was opened asynchronously or synchronously.

IsConnected IsConnected IsConnected IsConnected

取得或定值,指出是否已連接 PipeStream 物件。Gets or sets a value indicating whether a PipeStream object is connected.

IsHandleExposed IsHandleExposed IsHandleExposed IsHandleExposed

取得值,指出是否已公開 PipeStream 物件的控制代碼。Gets a value indicating whether a handle to a PipeStream object is exposed.

IsMessageComplete IsMessageComplete IsMessageComplete IsMessageComplete

取得值,指出最近一次讀取作業傳回的訊息中是否有更多資料。Gets a value indicating whether there is more data in the message returned from the most recent read operation.

Length Length Length Length

取得資料流的長度 (以位元組為單位)。Gets the length of a stream, in bytes.

OutBufferSize OutBufferSize OutBufferSize OutBufferSize

取得管道的傳出緩衝區大小 (以位元組為單位)。Gets the size, in bytes, of the outbound buffer for a pipe.

Position Position Position Position

取得或設定目前資料流目前的位置。Gets or sets the current position of the current stream.

ReadMode ReadMode ReadMode ReadMode

取得或設定 PipeStream 物件的讀取模式。Gets or sets the reading mode for a PipeStream object.

ReadTimeout ReadTimeout ReadTimeout ReadTimeout

取得或設定值 (以毫秒為單位),這個值決定在逾時前資料流將嘗試讀取多長時間。Gets or sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out.

(Inherited from Stream)
SafePipeHandle SafePipeHandle SafePipeHandle SafePipeHandle

取得目前 PipeStream 物件封裝之管道的本機端的安全控制代碼。Gets the safe handle for the local end of the pipe that the current PipeStream object encapsulates.

TransmissionMode TransmissionMode TransmissionMode TransmissionMode

取得目前管道支援的管道傳輸模式。Gets the pipe transmission mode supported by the current pipe.

WriteTimeout WriteTimeout WriteTimeout WriteTimeout

取得或設定值 (以毫秒為單位),這個值決定在逾時前資料流將嘗試寫入多長時間。Gets or sets a value, in milliseconds, that determines how long the stream will attempt to write before timing out.

(Inherited from Stream)

方法

BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)

開始非同步的讀取作業。Begins an asynchronous read operation.

BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)

開始非同步的寫入作業。Begins an asynchronous write operation.

CheckPipePropertyOperations() CheckPipePropertyOperations() CheckPipePropertyOperations() CheckPipePropertyOperations()

確認管道處於可取得或設定屬性的正確狀態。Verifies that the pipe is in a proper state for getting or setting properties.

CheckReadOperations() CheckReadOperations() CheckReadOperations() CheckReadOperations()

確認管道處於可讀取作業的連接狀態。Verifies that the pipe is in a connected state for read operations.

CheckWriteOperations() CheckWriteOperations() CheckWriteOperations() CheckWriteOperations()

確認管道處於可寫入作業的連接狀態。Verifies that the pipe is in a connected state for write operations.

Close() Close() Close() Close()

關閉目前資料流和釋放與目前資料流相關聯的任何資源 (例如通訊端和檔案控制代碼)。Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. 請確定正確地處置資料流,而非呼叫這個方法。Instead of calling this method, ensure that the stream is properly disposed.

(Inherited from Stream)
CopyTo(Stream) CopyTo(Stream) CopyTo(Stream) CopyTo(Stream)

從目前資料流讀取位元組,並將其寫入另一個資料流中。Reads the bytes from the current stream and writes them to another stream.

(Inherited from Stream)
CopyTo(Stream, Int32) CopyTo(Stream, Int32) CopyTo(Stream, Int32) CopyTo(Stream, Int32)

使用指定的緩衝區大小,從目前資料流讀取所有位元組,並將其寫入另一個資料流中。Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

(Inherited from Stream)
CopyToAsync(Stream) CopyToAsync(Stream) CopyToAsync(Stream) CopyToAsync(Stream)

以非同步的方式從目前資料流讀取所有位元組,並將其寫入另一個資料流中。Asynchronously reads the bytes from the current stream and writes them to another stream.

(Inherited from Stream)
CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken)

使用指定的取消權杖,以非同步的方式從目前資料流讀取位元組,並將其寫入另一個資料流。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified cancellation token.

(Inherited from Stream)
CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32)

使用指定的緩衝區大小,以非同步的方式從目前資料流讀取所有位元組,並將其寫入另一個資料流中。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

(Inherited from Stream)
CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken)

使用指定的緩衝區大小和取消語彙基元,以非同步的方式從目前資料流讀取位元組,並將其寫入另一個資料流。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

(Inherited from Stream)
CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
CreateWaitHandle() CreateWaitHandle() CreateWaitHandle() CreateWaitHandle()

配置 WaitHandle 物件。Allocates a WaitHandle object.

(Inherited from Stream)
Dispose() Dispose() Dispose() Dispose()

釋放 Stream 所使用的所有資源。Releases all resources used by the Stream.

(Inherited from Stream)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放 PipeStream 類別所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the PipeStream class and optionally releases the managed resources.

DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()

以非同步方式釋放 Stream 使用的不受控資源。Asynchronously releases the unmanaged resources used by the Stream.

(Inherited from Stream)
EndRead(IAsyncResult) EndRead(IAsyncResult) EndRead(IAsyncResult) EndRead(IAsyncResult)

結束擱置的非同步讀取要求。Ends a pending asynchronous read request.

EndWrite(IAsyncResult) EndWrite(IAsyncResult) EndWrite(IAsyncResult) EndWrite(IAsyncResult)

結束暫止的非同步寫入要求。Ends a pending asynchronous write request.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Flush() Flush() Flush() Flush()

清除目前資料流的緩衝區,並讓所有的緩衝資料全部寫入基礎裝置。Clears the buffer for the current stream and causes any buffered data to be written to the underlying device.

FlushAsync() FlushAsync() FlushAsync() FlushAsync()

以非同步的方式清除這個資料流的所有緩衝區,並造成所有緩衝資料都寫入基礎裝置。Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.

(Inherited from Stream)
FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken)

以非同步的方式清除這個資料流的所有緩衝區,造成所有緩衝資料都寫入基礎裝置,並且監視取消要求。Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

(Inherited from Stream)
GetAccessControl() GetAccessControl() GetAccessControl() GetAccessControl()

取得 PipeSecurity 物件,該物件會封裝目前 PipeStream 物件所描述之管道的存取控制清單 (ACL) 項目。Gets a PipeSecurity object that encapsulates the access control list (ACL) entries for the pipe described by the current PipeStream object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
InitializeHandle(SafePipeHandle, Boolean, Boolean) InitializeHandle(SafePipeHandle, Boolean, Boolean) InitializeHandle(SafePipeHandle, Boolean, Boolean) InitializeHandle(SafePipeHandle, Boolean, Boolean)

從指定的 SafePipeHandle 物件初始化 PipeStream 物件。Initializes a PipeStream object from the specified SafePipeHandle object.

InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ObjectInvariant() ObjectInvariant() ObjectInvariant() ObjectInvariant()

提供 Contract 的支援。Provides support for a Contract.

(Inherited from Stream)
Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32)

讀取資料流的位元組區塊,並將資料寫入指定的緩衝區。Reads a block of bytes from a stream and writes the data to a specified buffer.

Read(Span<Byte>) Read(Span<Byte>) Read(Span<Byte>) Read(Span<Byte>)
ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32)

以非同步的方式從目前的資料流讀取位元組序列,並依讀取的位元組數將資料流中的位置往前移。Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

(Inherited from Stream)
ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken)
ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken)
ReadByte() ReadByte() ReadByte() ReadByte()

從管道讀取位元組。Reads a byte from a pipe.

Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin)

將目前資料流目前的位置設定為指定的值。Sets the current position of the current stream to the specified value.

SetAccessControl(PipeSecurity) SetAccessControl(PipeSecurity) SetAccessControl(PipeSecurity) SetAccessControl(PipeSecurity)

PipeSecurity 物件所指定的存取控制清單 (ACL) 項目套用至目前 PipeStream 物件所指定的管道。Applies the access control list (ACL) entries specified by a PipeSecurity object to the pipe specified by the current PipeStream object.

SetLength(Int64) SetLength(Int64) SetLength(Int64) SetLength(Int64)

將目前資料流的長度設定為指定的數值。Sets the length of the current stream to the specified value.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
WaitForPipeDrain() WaitForPipeDrain() WaitForPipeDrain() WaitForPipeDrain()

等待管道另一端讀取已傳送的所有位元組。Waits for the other end of the pipe to read all sent bytes.

Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32)

使用緩衝區的資料,將位元組區塊寫入目前的資料流。Writes a block of bytes to the current stream using data from a buffer.

Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>)
WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32)

以非同步的方式將位元組序列寫入至目前的資料流,並依寫入的位元組數將資料流中目前的位置往前移。Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

(Inherited from Stream)
WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken)
WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)
WriteByte(Byte) WriteByte(Byte) WriteByte(Byte) WriteByte(Byte)

將位元組寫入目前的資料流。Writes a byte to the current stream.

明確介面實作

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

釋放 Stream 所使用的所有資源。Releases all resources used by the Stream.

(Inherited from Stream)

Extension Methods

GetAccessControl(PipeStream) GetAccessControl(PipeStream) GetAccessControl(PipeStream) GetAccessControl(PipeStream)
SetAccessControl(PipeStream, PipeSecurity) SetAccessControl(PipeStream, PipeSecurity) SetAccessControl(PipeStream, PipeSecurity) SetAccessControl(PipeStream, PipeSecurity)

安全性

InheritanceDemand
針對繼承者完全信任。for full trust for inheritors. 這個類別無法繼承由部分信任的程式碼。This class cannot be inherited by partially trusted code.

適用於