PipeStream 類別

定義

公開管道的 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. 如需匿名管道的範例,請參閱如何:使用匿名管道進行本機處理序間通訊For an example of anonymous pipes, see How to: Use Anonymous Pipes for Local Interprocess Communication. 如需具名管道的範例,請參閱如何:使用具名管道進行網路處理序間通訊For an example of named pipes, see How to: Use Named Pipes for Network Interprocess Communication.

建構函式

PipeStream(PipeDirection, Int32)

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

PipeStream(PipeDirection, PipeTransmissionMode, Int32)

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

屬性

CanRead

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

CanSeek

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

CanTimeout

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

(繼承來源 Stream)
CanWrite

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

InBufferSize

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

IsAsync

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

IsConnected

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

IsHandleExposed

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

IsMessageComplete

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

Length

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

OutBufferSize

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

Position

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

ReadMode

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

ReadTimeout

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

(繼承來源 Stream)
SafePipeHandle

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

TransmissionMode

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

WriteTimeout

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

(繼承來源 Stream)

方法

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

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

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

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

CheckPipePropertyOperations()

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

CheckReadOperations()

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

CheckWriteOperations()

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

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.

(繼承來源 Stream)
CopyTo(Stream)

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

(繼承來源 Stream)
CopyTo(Stream, Int32)

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

(繼承來源 Stream)
CopyToAsync(Stream)

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

(繼承來源 Stream)
CopyToAsync(Stream, CancellationToken)

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

(繼承來源 Stream)
CopyToAsync(Stream, Int32)

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

(繼承來源 Stream)
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.

(繼承來源 Stream)
CreateObjRef(Type)

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

(繼承來源 MarshalByRefObject)
CreateWaitHandle()

配置 WaitHandle 物件。Allocates a WaitHandle object.

(繼承來源 Stream)
Dispose()

釋出 Stream 所使用的全部資源。Releases all resources used by the Stream.

(繼承來源 Stream)
Dispose(Boolean)

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

DisposeAsync()

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

(繼承來源 Stream)
EndRead(IAsyncResult)

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

EndWrite(IAsyncResult)

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

Equals(Object)

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

(繼承來源 Object)
Flush()

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

FlushAsync()

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

(繼承來源 Stream)
FlushAsync(CancellationToken)

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

(繼承來源 Stream)
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()

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

(繼承來源 Object)
GetLifetimeService()

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

(繼承來源 MarshalByRefObject)
GetType()

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

(繼承來源 Object)
InitializeHandle(SafePipeHandle, Boolean, Boolean)

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

InitializeLifetimeService()

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

(繼承來源 MarshalByRefObject)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
MemberwiseClone(Boolean)

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

(繼承來源 MarshalByRefObject)
ObjectInvariant()

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

(繼承來源 Stream)
Read(Byte[], Int32, Int32)

從資料流讀取位元組區塊,並將資料寫入至起始於指定位置且具有指定長度的指定緩衝區。Reads a block of bytes from a stream and writes the data to a specified buffer starting at a specified position for a specified length.

Read(Span<Byte>)

從目前的資料流讀取位元組序列、將其寫入至位元組陣列,並依讀取的位元組數將資料流中位置往前移。Reads a sequence of bytes from the current stream, writes them to a byte array, and advances the position within the stream by the number of bytes read.

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.

(繼承來源 Stream)
ReadAsync(Byte[], Int32, Int32, CancellationToken)

以非同步方式將目前資料流中位元組序列讀入起始於指定位置且具有指定位元組數的位元組陣列、依讀取的位元組數將資料流中位置往前移,並監視取消要求。Asynchronously reads a sequence of bytes from the current stream to a byte array starting at a specified position for a specified number of bytes, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

ReadAsync(Memory<Byte>, CancellationToken)

以非同步方式從目前的資料流讀取位元組序列、將其寫入至位元組記憶體範圍、依讀取的位元組數將資料流中位置往前移,並監視取消要求。Asynchronously reads a sequence of bytes from the current stream, writes them to a byte memory range, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

ReadByte()

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

Seek(Int64, SeekOrigin)

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

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)

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

ToString()

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

(繼承來源 Object)
WaitForPipeDrain()

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

Write(Byte[], Int32, Int32)

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

Write(ReadOnlySpan<Byte>)

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

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.

(繼承來源 Stream)
WriteAsync(Byte[], Int32, Int32, CancellationToken)

以非同步方式從起始於指定位置的位元組陣列寫入所指定位元組數、依寫入的位元組數將此資料流中目前位置往前移,並監視取消要求。Asynchronously writes a specified number of bytes from a byte array starting at a specified position, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)

以非同步的方式將一連串的位元組寫入目前的資料流,由這個資料流中目前的位置前移寫入的位元組數目,並且監視取消要求。Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

WriteByte(Byte)

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

明確介面實作

IDisposable.Dispose()

釋出 Stream 所使用的全部資源。Releases all resources used by the Stream.

(繼承來源 Stream)

擴充方法

GetAccessControl(PipeStream)
SetAccessControl(PipeStream, PipeSecurity)

安全性

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

適用於