CryptoStream.Read(Byte[], Int32, Int32) Método
Definição
Lê uma sequência de bytes do fluxo atual e avança a posição no fluxo até o número de bytes lidos.Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
public:
override int Read(cli::array <System::Byte> ^ buffer, int offset, int count);
public override int Read (byte[] buffer, int offset, int count);
override this.Read : byte[] * int * int -> int
Public Overrides Function Read (buffer As Byte(), offset As Integer, count As Integer) As Integer
Parâmetros
- buffer
- Byte[]
Uma matriz de bytes.An array of bytes. Um máximo de count bytes são lidos do fluxo atual e armazenados em buffer.A maximum of count bytes are read from the current stream and stored in buffer.
- offset
- Int32
O deslocamento de bytes em buffer no qual será iniciada a leitura de dados no fluxo atual.The byte offset in buffer at which to begin storing the data read from the current stream.
- count
- Int32
O número máximo de bytes a serem lidos no fluxo atual.The maximum number of bytes to be read from the current stream.
Retornos
O número total de bytes lidos do buffer.The total number of bytes read into the buffer. Isso poderá ser menor que o número de bytes solicitado se tal quantidade de bytes não estiver disponível no momento ou zero se o final do fluxo tiver sido atingido.This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream has been reached.
Exceções
O CryptoStreamMode associado ao objeto CryptoStream atual não corresponde ao fluxo subjacente.The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. Por exemplo, essa exceção é gerada ao usar Read com um fluxo subjacente que é somente gravação.For example, this exception is thrown when using Read with an underlying stream that is write only.
O parâmetro offset é menor que zero.The offset parameter is less than zero.
- ou --or-
O parâmetro count é menor que zero.The count parameter is less than zero.
A soma dos parâmetros count e offset é maior do que o tamanho do buffer.The sum of the count and offset parameters is longer than the length of the buffer.