BufferedStream Construtores

Definição

Inicializa uma nova instância da classe BufferedStream.Initializes a new instance of the BufferedStream class.

Sobrecargas

BufferedStream(Stream)

Inicializa uma nova instância da classe BufferedStream com o tamanho do buffer padrão de 4096 bytes.Initializes a new instance of the BufferedStream class with a default buffer size of 4096 bytes.

BufferedStream(Stream, Int32)

Inicializa uma nova instância da classe BufferedStream com o tamanho do buffer especificado.Initializes a new instance of the BufferedStream class with the specified buffer size.

BufferedStream(Stream)

Inicializa uma nova instância da classe BufferedStream com o tamanho do buffer padrão de 4096 bytes.Initializes a new instance of the BufferedStream class with a default buffer size of 4096 bytes.

public:
 BufferedStream(System::IO::Stream ^ stream);
public BufferedStream (System.IO.Stream stream);
new System.IO.BufferedStream : System.IO.Stream -> System.IO.BufferedStream
Public Sub New (stream As Stream)

Parâmetros

stream
Stream

O fluxo atual.The current stream.

Exceções

stream é null.stream is null.

Comentários

Um buffer de leitura/gravação compartilhado é alocado na primeira vez que um BufferedStream objeto é inicializado com esse construtor.A shared read/write buffer is allocated the first time a BufferedStream object is initialized with this constructor. O buffer compartilhado não será usado se todas as leituras e gravações forem maiores ou iguais a bufferSize .The shared buffer is not used if all reads and writes are greater than or equal to bufferSize.

Aplica-se a

BufferedStream(Stream, Int32)

Inicializa uma nova instância da classe BufferedStream com o tamanho do buffer especificado.Initializes a new instance of the BufferedStream class with the specified buffer size.

public:
 BufferedStream(System::IO::Stream ^ stream, int bufferSize);
public BufferedStream (System.IO.Stream stream, int bufferSize);
new System.IO.BufferedStream : System.IO.Stream * int -> System.IO.BufferedStream
Public Sub New (stream As Stream, bufferSize As Integer)

Parâmetros

stream
Stream

O fluxo atual.The current stream.

bufferSize
Int32

O tamanho do buffer em bytes.The buffer size in bytes.

Exceções

stream é null.stream is null.

bufferSize é negativo.bufferSize is negative.

Exemplos

Este exemplo de código faz parte de um exemplo maior fornecido para a BufferedStream classe.This code example is part of a larger example provided for the BufferedStream class.

// Create a NetworkStream that owns clientSocket and 
// then create a BufferedStream on top of the NetworkStream.
NetworkStream^ netStream = gcnew NetworkStream( clientSocket,true );
BufferedStream^ bufStream = gcnew BufferedStream( netStream,streamBufferSize );

// Create a NetworkStream that owns clientSocket and
// then create a BufferedStream on top of the NetworkStream.
// Both streams are disposed when execution exits the
// using statement.
using(Stream
    netStream = new NetworkStream(clientSocket, true),
    bufStream =
          new BufferedStream(netStream, streamBufferSize))
' Create a NetworkStream that owns clientSocket and then 
' create a BufferedStream on top of the NetworkStream.
Dim netStream As New NetworkStream(clientSocket, True)
Dim bufStream As New _
    BufferedStream(netStream, streamBufferSize)

Comentários

Um buffer de leitura/gravação compartilhado é alocado na primeira vez que um BufferedStream objeto é inicializado com esse construtor.A shared read/write buffer is allocated the first time a BufferedStream object is initialized with this constructor. O buffer compartilhado não será usado se todas as leituras e gravações forem maiores ou iguais a bufferSize .The shared buffer is not used if all reads and writes are greater than or equal to bufferSize.

Aplica-se a